Merge pull request #1188 from karalabe/newblockhashes-proposal

eth: implement the NewBlockHashes protocol proposal
This commit is contained in:
Jeffrey Wilcke
2015-06-09 04:07:46 -07:00
4 changed files with 262 additions and 81 deletions
+7
View File
@@ -88,6 +88,13 @@ func (p *peer) sendBlocks(blocks []*types.Block) error {
return p2p.Send(p.rw, BlocksMsg, blocks)
}
func (p *peer) sendNewBlockHashes(hashes []common.Hash) error {
for _, hash := range hashes {
p.blockHashes.Add(hash)
}
return p2p.Send(p.rw, NewBlockHashesMsg, hashes)
}
func (p *peer) sendNewBlock(block *types.Block) error {
p.blockHashes.Add(block.Hash())