From 696097370eb7a7120151af5a4d323f0bb05ecbcb Mon Sep 17 00:00:00 2001 From: Antioch Peverell <30642645+antiochp@users.noreply.github.com> Date: Tue, 27 Mar 2018 16:48:09 -0400 Subject: [PATCH] do not save header during header first sync (#891) just use the header as a hint to go request the block --- chain/src/chain.rs | 6 +----- chain/src/pipe.rs | 18 ++++-------------- grin/src/adapters.rs | 13 +++++++++++-- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 16fcf285..026544a9 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -339,11 +339,7 @@ impl Chain { } /// Process a block header received during "header first" propagation. - pub fn process_block_header( - &self, - bh: &BlockHeader, - opts: Options, - ) -> Result, Error> { + pub fn process_block_header(&self, bh: &BlockHeader, opts: Options) -> Result<(), Error> { let header_head = self.get_header_head()?; let ctx = self.ctx_from_head(header_head, opts); pipe::process_block_header(bh, ctx) diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index e343f0e8..0ca8b2b0 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -164,7 +164,9 @@ pub fn sync_block_header( } /// Process block header as part of "header first" block propagation. -pub fn process_block_header(bh: &BlockHeader, mut ctx: BlockContext) -> Result, Error> { +/// We validate the header but we do not store it or update header head based on this. +/// We will update these once we get the block back after requesting it. +pub fn process_block_header(bh: &BlockHeader, mut ctx: BlockContext) -> Result<(), Error> { debug!( LOGGER, "pipe: process_block_header: {} at {}", @@ -173,19 +175,7 @@ pub fn process_block_header(bh: &BlockHeader, mut ctx: BlockContext) -> Result