diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-20 17:29:07 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-20 17:29:07 +0800 |
commit | adaa49d2cc55d5c3c7cc5266e80995b9a21adcab (patch) | |
tree | f5c78da61ce00c637b6f05932162a645ba8581d1 | |
parent | 79042223dc5f2ae5d4a2ed73d18907440a963093 (diff) | |
parent | 3c8227b935fdc9eda7a6cfacc2e0d0d189e7bb36 (diff) | |
download | dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar.gz dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar.bz2 dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar.lz dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar.xz dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.tar.zst dexon-adaa49d2cc55d5c3c7cc5266e80995b9a21adcab.zip |
Merge pull request #1051 from karalabe/fix-odd-naming
eth: fix odd method names in peer set
-rw-r--r-- | eth/handler.go | 4 | ||||
-rw-r--r-- | eth/peer.go | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/eth/handler.go b/eth/handler.go index 835097d84..8dd254b1a 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -350,7 +350,7 @@ func (pm *ProtocolManager) verifyTd(peer *peer, request newBlockMsgData) error { // sqrt(peers) to determine the amount of peers we broadcast to. func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) { // Broadcast block to a batch of peers not knowing about it - peers := pm.peers.BlockLackingPeers(hash) + peers := pm.peers.PeersWithoutBlock(hash) peers = peers[:int(math.Sqrt(float64(len(peers))))] for _, peer := range peers { peer.sendNewBlock(block) @@ -363,7 +363,7 @@ func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) // sqrt(peers) to determine the amount of peers we broadcast to. func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction) { // Broadcast transaction to a batch of peers not knowing about it - peers := pm.peers.TxLackingPeers(hash) + peers := pm.peers.PeersWithoutTx(hash) //FIXME include this again: peers = peers[:int(math.Sqrt(float64(len(peers))))] for _, peer := range peers { peer.sendTransaction(tx) diff --git a/eth/peer.go b/eth/peer.go index a23449acd..fdd815293 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -213,9 +213,9 @@ func (ps *peerSet) Len() int { return len(ps.peers) } -// BlockLackingPeers retrieves a list of peers that do not have a given block -// in their set of known hashes. -func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer { +// PeersWithoutBlock retrieves a list of peers that do not have a given block in +// their set of known hashes. +func (ps *peerSet) PeersWithoutBlock(hash common.Hash) []*peer { ps.lock.RLock() defer ps.lock.RUnlock() @@ -228,9 +228,9 @@ func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer { return list } -// TxLackingPeers retrieves a list of peers that do not have a given transaction +// PeersWithoutTx retrieves a list of peers that do not have a given transaction // in their set of known hashes. -func (ps *peerSet) TxLackingPeers(hash common.Hash) []*peer { +func (ps *peerSet) PeersWithoutTx(hash common.Hash) []*peer { ps.lock.RLock() defer ps.lock.RUnlock() |