mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-22 19:49:33 +00:00
Storage: use saturating_add
for cumulative_generated_coins
(#275)
* use `saturating_add` for `cumulative_generated_coins` * cargo fmt
This commit is contained in:
parent
967537fae1
commit
49d1344aa1
1 changed files with 2 additions and 1 deletions
|
@ -89,9 +89,10 @@ pub fn add_block(
|
|||
// RCT output count needs account for _this_ block's outputs.
|
||||
let cumulative_rct_outs = get_rct_num_outputs(tables.rct_outputs())?;
|
||||
|
||||
// `saturating_add` is used here as cumulative generated coins overflows due to tail emission.
|
||||
let cumulative_generated_coins =
|
||||
cumulative_generated_coins(&block.height.saturating_sub(1), tables.block_infos())?
|
||||
+ block.generated_coins;
|
||||
.saturating_add(block.generated_coins);
|
||||
|
||||
let (cumulative_difficulty_low, cumulative_difficulty_high) =
|
||||
split_u128_into_low_high_bits(block.cumulative_difficulty);
|
||||
|
|
Loading…
Reference in a new issue