fix race condition (#3344)

This commit is contained in:
Antioch Peverell 2020-06-10 13:56:33 +01:00 committed by GitHub
parent 093c500fed
commit b98e5e06a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,14 +219,7 @@ pub fn sync_block_headers(
txhashset::header_extending(&mut ctx.header_pmmr, &mut ctx.batch, |ext, batch| {
rewind_and_apply_header_fork(&last_header, ext, batch)?;
Ok(())
})?;
let header_head = ctx.batch.header_head()?;
if has_more_work(last_header, &header_head) {
update_header_head(&Tip::from_header(last_header), &mut ctx.batch)?;
}
Ok(())
})
}
/// Process a block header. Update the header MMR and corresponding header_head if this header