Skip to content

Commit

Permalink
perf: One less DB call when verifying block sums
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Goulden committed Jul 11, 2019
1 parent 09cf6de commit a9e6ac4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions chain/src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,8 @@ fn verify_coinbase_maturity(block: &Block, ext: &txhashset::Extension<'_>) -> Re
/// based on block_sums of previous block, accounting for the inputs|outputs|kernels
/// of the new block.
fn verify_block_sums(b: &Block, ext: &mut txhashset::Extension<'_>) -> Result<(), Error> {
// TODO - this is 2 db calls, can we optimize this?
// Retrieve the block_sums for the previous block.
let prev = ext.batch.get_previous_header(&b.header)?;
let block_sums = ext.batch.get_block_sums(&prev.hash())?;
let block_sums = ext.batch.get_block_sums(&b.header.prev_hash)?;

// Overage is based purely on the new block.
// Previous block_sums have taken all previous overage into account.
Expand Down

0 comments on commit a9e6ac4

Please sign in to comment.