From 78a6447a092d82d985fcede425297b97596665b2 Mon Sep 17 00:00:00 2001 From: Antioch Peverell <30642645+antiochp@users.noreply.github.com> Date: Wed, 7 Feb 2018 11:26:52 -0500 Subject: [PATCH] fix bad merge - missing support for header msg type (#690) --- p2p/src/protocol.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/p2p/src/protocol.rs b/p2p/src/protocol.rs index 14dd30062..32af59e3e 100644 --- a/p2p/src/protocol.rs +++ b/p2p/src/protocol.rs @@ -88,7 +88,7 @@ impl MessageHandler for Protocol { adapter.block_received(b, self.addr); Ok(None) } - + Type::GetCompactBlock => { let h: Hash = msg.body()?; @@ -141,6 +141,18 @@ impl MessageHandler for Protocol { return Ok(Some((header_bytes, Type::Headers))); } + // "header first" block propagation - if we have not yet seen this block + // we can go request it from some of our peers + Type::Header => { + let header: core::BlockHeader = msg.body()?; + + adapter.header_received(header, self.addr); + + // we do not return a hash here as we never request a single header + // a header will always arrive unsolicited + Ok(None) + } + Type::Headers => { let headers: Headers = msg.body()?; adapter.headers_received(headers.headers, self.addr);