diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-02 23:14:41 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-18 15:14:41 +0000 |
commit | 588e670089079cbdfbf61465116ee759aa76c3f5 (patch) | |
tree | 09cf93f5dc4c1a5eaf020120c76d8975c416c241 /src/wallet | |
parent | wallet2: "output lineup" fake out selection (diff) | |
download | monero-588e670089079cbdfbf61465116ee759aa76c3f5.tar.xz |
simplewallet: fix output representation offset
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index cfe9e18c6..831166d5f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -964,13 +964,13 @@ gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets, double shap gamma = std::gamma_distribution<double>(shape, scale); THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, error::wallet_internal_error, "Bad offset calculation"); const size_t blocks_in_a_year = 86400 * 365 / DIFFICULTY_TARGET_V2; - const size_t blocks_to_consider = rct_offsets.size() < blocks_in_a_year; + 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); begin = rct_offsets.data(); end = rct_offsets.data() + rct_offsets.size() - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE; num_rct_outputs = *(end - 1); THROW_WALLET_EXCEPTION_IF(num_rct_outputs == 0, error::wallet_internal_error, "No rct outputs"); - average_output_time = DIFFICULTY_TARGET_V2 * rct_offsets.size() / num_rct_outputs; // this assumes constant target over the whole rct range + average_output_time = DIFFICULTY_TARGET_V2 * blocks_to_consider / outputs_to_consider; // this assumes constant target over the whole rct range }; gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets): gamma_picker(rct_offsets, GAMMA_SHAPE, GAMMA_SCALE) {} |