Merge pull request #1051 from karalabe/fix-odd-naming

eth: fix odd method names in peer set
This commit is contained in:
Jeffrey Wilcke 2015-05-20 02:29:07 -07:00
commit adaa49d2cc
2 changed files with 7 additions and 7 deletions

View File

@ -350,7 +350,7 @@ func (pm *ProtocolManager) verifyTd(peer *peer, request newBlockMsgData) error {
// sqrt(peers) to determine the amount of peers we broadcast to. // sqrt(peers) to determine the amount of peers we broadcast to.
func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) { func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) {
// Broadcast block to a batch of peers not knowing about it // 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))))] peers = peers[:int(math.Sqrt(float64(len(peers))))]
for _, peer := range peers { for _, peer := range peers {
peer.sendNewBlock(block) 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. // sqrt(peers) to determine the amount of peers we broadcast to.
func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction) { func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction) {
// Broadcast transaction to a batch of peers not knowing about it // 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))))] //FIXME include this again: peers = peers[:int(math.Sqrt(float64(len(peers))))]
for _, peer := range peers { for _, peer := range peers {
peer.sendTransaction(tx) peer.sendTransaction(tx)

View File

@ -213,9 +213,9 @@ func (ps *peerSet) Len() int {
return len(ps.peers) return len(ps.peers)
} }
// BlockLackingPeers retrieves a list of peers that do not have a given block // PeersWithoutBlock retrieves a list of peers that do not have a given block in
// in their set of known hashes. // their set of known hashes.
func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer { func (ps *peerSet) PeersWithoutBlock(hash common.Hash) []*peer {
ps.lock.RLock() ps.lock.RLock()
defer ps.lock.RUnlock() defer ps.lock.RUnlock()
@ -228,9 +228,9 @@ func (ps *peerSet) BlockLackingPeers(hash common.Hash) []*peer {
return list 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. // 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() ps.lock.RLock()
defer ps.lock.RUnlock() defer ps.lock.RUnlock()