Validate compact block header before hydrating

This commit is contained in:
Ignotus Peverell 2018-07-13 19:38:12 +01:00
parent 1e7e312cf3
commit a6af94a76f
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211

View file

@ -119,7 +119,12 @@ impl p2p::ChainAdapter for NetToChainAdapter {
// push the freshly hydrated block through the chain pipeline
self.process_block(block, addr)
} else {
// TODO - do we need to validate the header here?
// check at least the header is valid before hydrating
if let Err(e) = w(&self.chain).process_block_header(&cb.header, self.chain_opts()) {
debug!(LOGGER, "Invalid compact block header {}: {}", cb.hash(), e);
return !e.is_bad_data();
}
let txs = {
let tx_pool = self.tx_pool.read().unwrap();