From a661aa24847e1e3dc6c4c2e1a431ede81da95c57 Mon Sep 17 00:00:00 2001 From: j-berman Date: Fri, 16 Jul 2021 11:04:22 +0200 Subject: [PATCH] Fix precision of average_output_time The fix as suggested by on IRC. Before the fix, it would truncate 1.9 to 1 skewing the output selection. --- src/wallet/wallet2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 6bcc55cde..96bfc619d 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1031,7 +1031,7 @@ gamma_picker::gamma_picker(const std::vector &rct_offsets, double shap 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 * blocks_to_consider / outputs_to_consider; // this assumes constant target over the whole rct range + average_output_time = DIFFICULTY_TARGET_V2 * blocks_to_consider / static_cast(outputs_to_consider); // this assumes constant target over the whole rct range }; gamma_picker::gamma_picker(const std::vector &rct_offsets): gamma_picker(rct_offsets, GAMMA_SHAPE, GAMMA_SCALE) {}