diff options
author | josibake <josibake@protonmail.com> | 2023-10-02 16:57:44 +0200 |
---|---|---|
committer | josibake <josibake@protonmail.com> | 2024-01-19 15:04:56 +0100 |
commit | 18ad1b9142e91cef2f5c6a693eeb2d0fbb8c517d (patch) | |
tree | d32a35a363a7798f7b745e973c7240d96f86ce07 /src/wallet/test | |
parent | 5ad19668dbcc47486d1c18f711cea3d8a9d2e7e2 (diff) | |
download | bitcoin-18ad1b9142e91cef2f5c6a693eeb2d0fbb8c517d.tar.xz |
refactor: pass CRecipient to FundTransaction
Instead turning tx.vout into a vector of `CRecipient`, make `FundTransaction`
take a `CRecipient` vector directly. This allows us to remove SFFO logic from
the wrapper RPC `FundTransaction` since the `CRecipient` objects have already
been created with the correct SFFO values. This also allows us to remove
SFFO from both `FundTransaction` function signatures.
This sets us up in a future PR to be able to use these RPCs with BIP352
static payment codes.
Diffstat (limited to 'src/wallet/test')
-rw-r--r-- | src/wallet/test/fuzz/notifications.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wallet/test/fuzz/notifications.cpp b/src/wallet/test/fuzz/notifications.cpp index 203ab5f606..376060421c 100644 --- a/src/wallet/test/fuzz/notifications.cpp +++ b/src/wallet/test/fuzz/notifications.cpp @@ -132,6 +132,14 @@ struct FuzzedWallet { } } } + std::vector<CRecipient> recipients; + for (size_t idx = 0; idx < tx.vout.size(); idx++) { + const CTxOut& tx_out = tx.vout[idx]; + CTxDestination dest; + ExtractDestination(tx_out.scriptPubKey, dest); + CRecipient recipient = {dest, tx_out.nValue, subtract_fee_from_outputs.count(idx) == 1}; + recipients.push_back(recipient); + } CCoinControl coin_control; coin_control.m_allow_other_inputs = fuzzed_data_provider.ConsumeBool(); CallOneOf( @@ -158,7 +166,10 @@ struct FuzzedWallet { int change_position{fuzzed_data_provider.ConsumeIntegralInRange<int>(-1, tx.vout.size() - 1)}; bilingual_str error; - (void)FundTransaction(*wallet, tx, change_position, /*lockUnspents=*/false, subtract_fee_from_outputs, coin_control); + // Clear tx.vout since it is not meant to be used now that we are passing outputs directly. + // This sets us up for a future PR to completely remove tx from the function signature in favor of passing inputs directly + tx.vout.clear(); + (void)FundTransaction(*wallet, tx, recipients, change_position, /*lockUnspents=*/false, coin_control); } }; |