diff options
Diffstat (limited to 'p2p/testing/peerpool.go')
-rw-r--r-- | p2p/testing/peerpool.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/p2p/testing/peerpool.go b/p2p/testing/peerpool.go index ed00396e2..01ccce67e 100644 --- a/p2p/testing/peerpool.go +++ b/p2p/testing/peerpool.go @@ -21,22 +21,22 @@ import ( "sync" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/enode" ) type TestPeer interface { - ID() discover.NodeID + ID() enode.ID Drop(error) } // TestPeerPool is an example peerPool to demonstrate registration of peer connections type TestPeerPool struct { lock sync.Mutex - peers map[discover.NodeID]TestPeer + peers map[enode.ID]TestPeer } func NewTestPeerPool() *TestPeerPool { - return &TestPeerPool{peers: make(map[discover.NodeID]TestPeer)} + return &TestPeerPool{peers: make(map[enode.ID]TestPeer)} } func (p *TestPeerPool) Add(peer TestPeer) { @@ -53,14 +53,14 @@ func (p *TestPeerPool) Remove(peer TestPeer) { delete(p.peers, peer.ID()) } -func (p *TestPeerPool) Has(id discover.NodeID) bool { +func (p *TestPeerPool) Has(id enode.ID) bool { p.lock.Lock() defer p.lock.Unlock() _, ok := p.peers[id] return ok } -func (p *TestPeerPool) Get(id discover.NodeID) TestPeer { +func (p *TestPeerPool) Get(id enode.ID) TestPeer { p.lock.Lock() defer p.lock.Unlock() return p.peers[id] |