Skip to content

Commit

Permalink
Merge pull request #111 from victor-tucci/integer-trunc-avoid
Browse files Browse the repository at this point in the history
Avoid integer truncation
  • Loading branch information
sanada08 authored Aug 3, 2023
2 parents a6295fd + efbcb5f commit c3129b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/wallet2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets, double shap
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= (hf_version>=cryptonote::network_version_17_POS?CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE_V17:CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE), error::wallet_internal_error, "Bad offset calculation");
const size_t blocks_in_a_year = BLOCKS_EXPECTED_IN_YEARS(1,hf_version);
const size_t blocks_to_consider = std::min<size_t>(rct_offsets.size(), blocks_in_a_year);
const size_t outputs_to_consider = rct_offsets.back() - (blocks_to_consider < rct_offsets.size() ? rct_offsets[rct_offsets.size() - blocks_to_consider - 1] : 0);
const double outputs_to_consider = rct_offsets.back() - (blocks_to_consider < rct_offsets.size() ? rct_offsets[rct_offsets.size() - blocks_to_consider - 1] : 0);
begin = rct_offsets.data();
end = rct_offsets.data() + rct_offsets.size() - (hf_version>=cryptonote::network_version_17_POS?CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE_V17:CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE);
num_rct_outputs = *(end - 1);
Expand Down

0 comments on commit c3129b8

Please sign in to comment.