aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-05-25 19:04:13 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-05-25 19:04:23 -0400
commit192d639a6b1bd0feaa52e6ea4e63e33982704c32 (patch)
tree327dd1a11e39060737e9e31746178b6e6fbc4546
parentb4f686952a60bbadc7ed2250651d0d6af0959f4d (diff)
parentc97e961d4652acfc55fd50273cf0a20beb4857e0 (diff)
downloadbitcoin-192d639a6b1bd0feaa52e6ea4e63e33982704c32.tar.xz
Merge bitcoin/bitcoin#25213: fuzz: fix crash at coinselection, add missing fee rate.
c97e961d4652acfc55fd50273cf0a20beb4857e0 fuzz: coinselection, add missing fee rate. (furszy) Pull request description: Fixing https://github.com/bitcoin/bitcoin/pull/25083#issuecomment-1136774756. 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 c97e961d4652acfc55fd50273cf0a20beb4857e0 ishaanam: ACK c97e961d4652acfc55fd50273cf0a20beb4857e0 Xekyo: ACK c97e961d4652acfc55fd50273cf0a20beb4857e0 brunoerg: ACK c97e961d4652acfc55fd50273cf0a20beb4857e0 Tree-SHA512: f495886a5078842103e0f05a9018d7cb491967d8362f893dd7b21132b98e94321df860c50acb69e84d7232779f5915322ca6b5f99908e05e0480012580ee9d5d
-rw-r--r--src/wallet/test/fuzz/coinselection.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp
index 2693b68cca..3465f2f331 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<COutput>& coins)
+static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector<COutput>& 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;
}