From adb03f295e74a358e043c3e6cf4f60a38195745b Mon Sep 17 00:00:00 2001 From: Joseph Goulden Date: Fri, 12 Jul 2019 07:01:46 +0100 Subject: [PATCH] fix: One less DB call when verifying block sums --- chain/src/pipe.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index ae75e7289f..b85d8cb1fd 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -429,10 +429,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.