From c97e961d4652acfc55fd50273cf0a20beb4857e0 Mon Sep 17 00:00:00 2001 From: furszy Date: Wed, 25 May 2022 13:14:34 -0300 Subject: [PATCH] fuzz: coinselection, add missing fee rate. Otherwise, 'GroupOutputs' will crash at group insertion time (output.GetEffectiveValue() asserts that the value exists). --- src/wallet/test/fuzz/coinselection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index 2693b68ccae..3465f2f331c 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -14,13 +14,13 @@ namespace wallet { -static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector& coins) +static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector& coins, CFeeRate fee_rate) { CMutableTransaction tx; tx.vout.resize(n_input + 1); tx.vout[n_input].nValue = value; tx.nLockTime = locktime; // all transactions get different hashes - coins.emplace_back(COutPoint(tx.GetHash(), n_input), tx.vout.at(n_input), /*depth=*/0, n_input_bytes, /*spendable=*/true, /*solvable=*/true, /*safe=*/true, /*time=*/0, /*from_me=*/true); + coins.emplace_back(COutPoint(tx.GetHash(), n_input), tx.vout.at(n_input), /*depth=*/0, n_input_bytes, /*spendable=*/true, /*solvable=*/true, /*safe=*/true, /*time=*/0, /*from_me=*/true, fee_rate); } // Randomly distribute coins to instances of OutputGroup @@ -70,7 +70,7 @@ FUZZ_TARGET(coinselection) if (total_balance + amount >= MAX_MONEY) { break; } - AddCoin(amount, n_input, n_input_bytes, ++next_locktime, utxo_pool); + AddCoin(amount, n_input, n_input_bytes, ++next_locktime, utxo_pool, coin_params.m_effective_feerate); total_balance += amount; }