Skip to content

Commit c97e961

Browse files
committed
fuzz: coinselection, add missing fee rate.
Otherwise, 'GroupOutputs' will crash at group insertion time (output.GetEffectiveValue() asserts that the value exists).
1 parent b4f6869 commit c97e961

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wallet/test/fuzz/coinselection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
namespace wallet {
1616

17-
static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector<COutput>& coins)
17+
static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector<COutput>& coins, CFeeRate fee_rate)
1818
{
1919
CMutableTransaction tx;
2020
tx.vout.resize(n_input + 1);
2121
tx.vout[n_input].nValue = value;
2222
tx.nLockTime = locktime; // all transactions get different hashes
23-
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);
23+
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);
2424
}
2525

2626
// Randomly distribute coins to instances of OutputGroup
@@ -70,7 +70,7 @@ FUZZ_TARGET(coinselection)
7070
if (total_balance + amount >= MAX_MONEY) {
7171
break;
7272
}
73-
AddCoin(amount, n_input, n_input_bytes, ++next_locktime, utxo_pool);
73+
AddCoin(amount, n_input, n_input_bytes, ++next_locktime, utxo_pool, coin_params.m_effective_feerate);
7474
total_balance += amount;
7575
}
7676

0 commit comments

Comments
 (0)