Skip to content

Commit 192d639

Browse files
committed
Merge bitcoin/bitcoin#25213: fuzz: fix crash at coinselection, add missing fee rate.
c97e961 fuzz: coinselection, add missing fee rate. (furszy) Pull request description: Fixing bitcoin/bitcoin#25083 (comment). Without the fee rate, 'GroupOutputs' will crash at group insertion time `OutputGroup::Insert` because now `output.GetEffectiveValue()` asserts that the value exists. ACKs for top commit: achow101: ACK c97e961 ishaanam: ACK c97e961 Xekyo: ACK c97e961 brunoerg: ACK c97e961 Tree-SHA512: f495886a5078842103e0f05a9018d7cb491967d8362f893dd7b21132b98e94321df860c50acb69e84d7232779f5915322ca6b5f99908e05e0480012580ee9d5d
2 parents b4f6869 + c97e961 commit 192d639

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)