Skip to content

Commit

Permalink
skip hydrate if missing kernels, just request full block
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp committed Oct 10, 2019
1 parent 39016fa commit 05534c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions servers/src/common/adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,16 @@ impl p2p::ChainAdapter for NetToChainAdapter {
};

debug!(
"adapter: txs from tx pool - {}, (unknown kern_ids: {})",
"compact_block_received: txs from tx pool - {}, (unknown kern_ids: {})",
txs.len(),
missing_short_ids.len(),
);

// TODO - 3 scenarios here -
// 1) we hydrate a valid block (good to go)
// 2) we hydrate an invalid block (txs legit missing from our pool)
// 3) we hydrate an invalid block (peer sent us a "bad" compact block) - [TBD]
// If we have missing kernels then we know we cannot hydrate this compact block.
if missing_short_ids.len() > 0 {
self.request_block(&cb.header, peer_info);
return Ok(true);
}

let block = match core::Block::hydrate_from(cb.clone(), txs) {
Ok(block) => {
Expand Down

0 comments on commit 05534c9

Please sign in to comment.