From 6f415b96b3b8581e810a8f40f596d2d213681e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 4 Jun 2015 18:46:07 +0300 Subject: eth: implement the NewBlockHashes protocol proposal --- eth/peer.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'eth/peer.go') diff --git a/eth/peer.go b/eth/peer.go index bb6a20349..1146ebde3 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -88,6 +88,10 @@ func (p *peer) sendBlocks(blocks []*types.Block) error { return p2p.Send(p.rw, BlocksMsg, blocks) } +func (p *peer) sendNewBlockHashes(hashes []common.Hash) error { + return p2p.Send(p.rw, NewBlockHashesMsg, hashes) +} + func (p *peer) sendNewBlock(block *types.Block) error { p.blockHashes.Add(block.Hash()) -- cgit v1.2.3 From 8c012e103faf2283e9be3fab26dbcf4cc63c09da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 4 Jun 2015 19:11:06 +0300 Subject: eth: mark blocks as known when broadcasting hashes too --- eth/peer.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'eth/peer.go') diff --git a/eth/peer.go b/eth/peer.go index 1146ebde3..5a59c1a40 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -89,6 +89,9 @@ func (p *peer) sendBlocks(blocks []*types.Block) error { } func (p *peer) sendNewBlockHashes(hashes []common.Hash) error { + for _, hash := range hashes { + p.blockHashes.Add(hash) + } return p2p.Send(p.rw, NewBlockHashesMsg, hashes) } -- cgit v1.2.3