mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 12:21:09 +03:00
fix: One less DB call when verifying block sums (#2945)
This commit is contained in:
parent
2348214719
commit
3a4752635a
1 changed files with 1 additions and 3 deletions
|
@ -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
|
/// based on block_sums of previous block, accounting for the inputs|outputs|kernels
|
||||||
/// of the new block.
|
/// of the new block.
|
||||||
fn verify_block_sums(b: &Block, ext: &mut txhashset::Extension<'_>) -> Result<(), Error> {
|
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.
|
// 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(&b.header.prev_hash)?;
|
||||||
let block_sums = ext.batch.get_block_sums(&prev.hash())?;
|
|
||||||
|
|
||||||
// Overage is based purely on the new block.
|
// Overage is based purely on the new block.
|
||||||
// Previous block_sums have taken all previous overage into account.
|
// Previous block_sums have taken all previous overage into account.
|
||||||
|
|
Loading…
Reference in a new issue