Skip to content

Commit

Permalink
Prevent below_height underflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Vitae committed Apr 19, 2022
1 parent 4ffb443 commit d02549e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

7 changes: 6 additions & 1 deletion zcash_client_sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,12 @@ impl<'a, P: consensus::Parameters> WalletWrite for DataConnStmtCache<'a, P> {
}

// Prune the stored witnesses (we only expect rollbacks of at most 100 blocks).
wallet::prune_witnesses(up, block.block_height - 100)?;
let below_height = if block.block_height < BlockHeight::from(100) {
BlockHeight::from(0)
} else {
block.block_height - 100
};
wallet::prune_witnesses(up, below_height)?;

// Update now-expired transactions that didn't get mined.
wallet::update_expired_notes(up, block.block_height)?;
Expand Down

0 comments on commit d02549e

Please sign in to comment.