wallet: change FillPSBT to take sighash as optional
Instead of having the caller have to figure out the correct sane default to provide to FillPSBT, have FillPSBT do that by having it take the sighash type as an optional. This further allows it to distinguish between an explicit sighash type being provided and expecting the default value to be used.
This commit is contained in:
1 parent
e58b680923
commit
d6001dcd4a
15 files changed
+30
-27
No files matched your search
@@ -192,7 +192,8 @@ FUZZ_TARGET(scriptpubkeyman, .init = initialize_spkm)
|
||||
}
|
||||
auto psbt{*opt_psbt};
|
||||
const PrecomputedTransactionData txdata{PrecomputePSBTData(psbt)};
|
||||
const int sighash_type{fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 150)};
|
||||
std::optional<int> sighash_type{fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 151)};
|
||||
if (sighash_type == 151) sighash_type = std::nullopt;
|
||||
auto sign = fuzzed_data_provider.ConsumeBool();
|
||||
auto bip32derivs = fuzzed_data_provider.ConsumeBool();
|
||||
auto finalize = fuzzed_data_provider.ConsumeBool();
|
||||
|
||||
@@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(psbt_updater_test)
|
||||
|
||||
// Fill transaction with our data
|
||||
bool complete = true;
|
||||
BOOST_REQUIRE(!m_wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, false, true));
|
||||
BOOST_REQUIRE(!m_wallet.FillPSBT(psbtx, complete, std::nullopt, false, true));
|
||||
|
||||
// Get the final tx
|
||||
DataStream ssTx{};
|
||||
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(psbt_updater_test)
|
||||
|
||||
// Try to sign the mutated input
|
||||
SignatureData sigdata;
|
||||
BOOST_CHECK(m_wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, true, true));
|
||||
BOOST_CHECK(m_wallet.FillPSBT(psbtx, complete, std::nullopt, true, true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_hd_keypath)
|
||||
|
||||
Reference in new issue
Block a user