Skip to content

Commit

Permalink
fix: activate_z_coin_light_with_changing_height
Browse files Browse the repository at this point in the history
i confused min with max when fixing this potential panic. max is the one we want here, so that when we have 0.max(1) we get 1 and not 0
  • Loading branch information
mariocynicys committed Sep 5, 2024
1 parent 9f63e6f commit bcd4e1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm2src/coins/utxo/utxo_builder/utxo_coin_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ pub trait UtxoCoinBuilderCommonOps {
};

let secs_since_date = current_time_sec - date_s;
let days_since_date = (secs_since_date / DAY_IN_SECONDS).min(1) - 1;
let days_since_date = (secs_since_date / DAY_IN_SECONDS).max(1) - 1;
let blocks_to_sync = (days_since_date * blocks_per_day) + blocks_per_day;

if current_block_height < blocks_to_sync {
Expand Down

0 comments on commit bcd4e1c

Please sign in to comment.