aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-04-25 11:26:20 -0400
committerluigi1111 <luigi1111w@gmail.com>2023-04-25 11:26:20 -0400
commit0d9e79031140420fb9bc43da2ed2387680e8d623 (patch)
tree2afb3508f4b0f19969a3d0458ac848668c21a17f /src
parentMerge pull request #8798 (diff)
parentgamma picker: relax constructor requirements and test for selecting outputs f... (diff)
downloadmonero-0d9e79031140420fb9bc43da2ed2387680e8d623.tar.xz
Merge pull request #8802
eb0e405 gamma picker: relax constructor requirements and test for selecting outputs from first spendable block (jeffro256)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 8691eca38..a8c1ffd38 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1001,7 +1001,7 @@ gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets, double shap
rct_offsets(rct_offsets)
{
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");
+ THROW_WALLET_EXCEPTION_IF(rct_offsets.size() < std::max(1, 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 = 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);
@@ -8446,7 +8446,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
if (has_rct)
{
// check we're clear enough of rct start, to avoid corner cases below
- THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
+ THROW_WALLET_EXCEPTION_IF(rct_offsets.size() < std::max(1, CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE),
error::get_output_distribution, "Not enough rct outputs");
THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index,
error::get_output_distribution, "Daemon reports suspicious number of rct outputs");