Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
215c763d
Commit
215c763d
authored
Mar 04, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth, p2p: delete p2p.Blacklist
It is unused and untested right now. We can bring it back later if required.
parent
429828cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
67 deletions
+1
-67
backend.go
eth/backend.go
+1
-8
server.go
p2p/server.go
+0
-59
No files found.
eth/backend.go
View file @
215c763d
...
@@ -108,11 +108,9 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
...
@@ -108,11 +108,9 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
type
Ethereum
struct
{
type
Ethereum
struct
{
// Channel for shutting down the ethereum
// Channel for shutting down the ethereum
shutdownChan
chan
bool
shutdownChan
chan
bool
quit
chan
bool
// DB interface
// DB interface
db
ethutil
.
Database
db
ethutil
.
Database
blacklist
p2p
.
Blacklist
//*** SERVICES ***
//*** SERVICES ***
// State manager for processing new blocks and managing the over all states
// State manager for processing new blocks and managing the over all states
...
@@ -170,10 +168,8 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -170,10 +168,8 @@ func New(config *Config) (*Ethereum, error) {
eth
:=
&
Ethereum
{
eth
:=
&
Ethereum
{
shutdownChan
:
make
(
chan
bool
),
shutdownChan
:
make
(
chan
bool
),
quit
:
make
(
chan
bool
),
db
:
db
,
db
:
db
,
keyManager
:
keyManager
,
keyManager
:
keyManager
,
blacklist
:
p2p
.
NewBlacklist
(),
eventMux
:
&
event
.
TypeMux
{},
eventMux
:
&
event
.
TypeMux
{},
logger
:
ethlogger
,
logger
:
ethlogger
,
}
}
...
@@ -206,7 +202,6 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -206,7 +202,6 @@ func New(config *Config) (*Ethereum, error) {
Name
:
config
.
Name
,
Name
:
config
.
Name
,
MaxPeers
:
config
.
MaxPeers
,
MaxPeers
:
config
.
MaxPeers
,
Protocols
:
protocols
,
Protocols
:
protocols
,
Blacklist
:
eth
.
blacklist
,
NAT
:
config
.
NAT
,
NAT
:
config
.
NAT
,
NoDial
:
!
config
.
Dial
,
NoDial
:
!
config
.
Dial
,
BootstrapNodes
:
config
.
parseBootNodes
(),
BootstrapNodes
:
config
.
parseBootNodes
(),
...
@@ -280,8 +275,6 @@ func (s *Ethereum) Stop() {
...
@@ -280,8 +275,6 @@ func (s *Ethereum) Stop() {
// Close the database
// Close the database
defer
s
.
db
.
Close
()
defer
s
.
db
.
Close
()
close
(
s
.
quit
)
s
.
txSub
.
Unsubscribe
()
// quits txBroadcastLoop
s
.
txSub
.
Unsubscribe
()
// quits txBroadcastLoop
s
.
blockSub
.
Unsubscribe
()
// quits blockBroadcastLoop
s
.
blockSub
.
Unsubscribe
()
// quits blockBroadcastLoop
...
...
p2p/server.go
View file @
215c763d
...
@@ -66,10 +66,6 @@ type Server struct {
...
@@ -66,10 +66,6 @@ type Server struct {
// each peer.
// each peer.
Protocols
[]
Protocol
Protocols
[]
Protocol
// If Blacklist is set to a non-nil value, the given Blacklist
// is used to verify peer connections.
Blacklist
Blacklist
// If ListenAddr is set to a non-nil address, the server
// If ListenAddr is set to a non-nil address, the server
// will listen for incoming connections.
// will listen for incoming connections.
//
//
...
@@ -183,9 +179,6 @@ func (srv *Server) Start() (err error) {
...
@@ -183,9 +179,6 @@ func (srv *Server) Start() (err error) {
if
srv
.
setupFunc
==
nil
{
if
srv
.
setupFunc
==
nil
{
srv
.
setupFunc
=
setupConn
srv
.
setupFunc
=
setupConn
}
}
if
srv
.
Blacklist
==
nil
{
srv
.
Blacklist
=
NewBlacklist
()
}
// node table
// node table
ntab
,
err
:=
discover
.
ListenUDP
(
srv
.
PrivateKey
,
srv
.
ListenAddr
,
srv
.
NAT
)
ntab
,
err
:=
discover
.
ListenUDP
(
srv
.
PrivateKey
,
srv
.
ListenAddr
,
srv
.
NAT
)
...
@@ -417,8 +410,6 @@ func (srv *Server) addPeer(id discover.NodeID, p *Peer) (bool, DiscReason) {
...
@@ -417,8 +410,6 @@ func (srv *Server) addPeer(id discover.NodeID, p *Peer) (bool, DiscReason) {
return
false
,
DiscTooManyPeers
return
false
,
DiscTooManyPeers
case
srv
.
peers
[
id
]
!=
nil
:
case
srv
.
peers
[
id
]
!=
nil
:
return
false
,
DiscAlreadyConnected
return
false
,
DiscAlreadyConnected
case
srv
.
Blacklist
.
Exists
(
id
[
:
])
:
return
false
,
DiscUselessPeer
case
id
==
srv
.
ntab
.
Self
()
:
case
id
==
srv
.
ntab
.
Self
()
:
return
false
,
DiscSelf
return
false
,
DiscSelf
}
}
...
@@ -432,53 +423,3 @@ func (srv *Server) removePeer(p *Peer) {
...
@@ -432,53 +423,3 @@ func (srv *Server) removePeer(p *Peer) {
srv
.
lock
.
Unlock
()
srv
.
lock
.
Unlock
()
srv
.
peerWG
.
Done
()
srv
.
peerWG
.
Done
()
}
}
type
Blacklist
interface
{
Get
([]
byte
)
(
bool
,
error
)
Put
([]
byte
)
error
Delete
([]
byte
)
error
Exists
(
pubkey
[]
byte
)
(
ok
bool
)
}
type
BlacklistMap
struct
{
blacklist
map
[
string
]
bool
lock
sync
.
RWMutex
}
func
NewBlacklist
()
*
BlacklistMap
{
return
&
BlacklistMap
{
blacklist
:
make
(
map
[
string
]
bool
),
}
}
func
(
self
*
BlacklistMap
)
Get
(
pubkey
[]
byte
)
(
bool
,
error
)
{
self
.
lock
.
RLock
()
defer
self
.
lock
.
RUnlock
()
v
,
ok
:=
self
.
blacklist
[
string
(
pubkey
)]
var
err
error
if
!
ok
{
err
=
fmt
.
Errorf
(
"not found"
)
}
return
v
,
err
}
func
(
self
*
BlacklistMap
)
Exists
(
pubkey
[]
byte
)
(
ok
bool
)
{
self
.
lock
.
RLock
()
defer
self
.
lock
.
RUnlock
()
_
,
ok
=
self
.
blacklist
[
string
(
pubkey
)]
return
}
func
(
self
*
BlacklistMap
)
Put
(
pubkey
[]
byte
)
error
{
self
.
lock
.
Lock
()
defer
self
.
lock
.
Unlock
()
self
.
blacklist
[
string
(
pubkey
)]
=
true
return
nil
}
func
(
self
*
BlacklistMap
)
Delete
(
pubkey
[]
byte
)
error
{
self
.
lock
.
Lock
()
defer
self
.
lock
.
Unlock
()
delete
(
self
.
blacklist
,
string
(
pubkey
))
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment