mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-30 07:43:48 +02:00
refactor: use PSBTFillOptions for filling and signing
Replace the sign, finalize , bip32derivs and sighash_type arguments which are passed to FillPSBT() and SignPSBTInput() with a PSBTFillOptions struct. This makes it easier to add additional options later without large code churn, such as avoid_script_path proposed in #32857. It also makes the use of default boolean options safer compared to positional arguments that can easily get mixed up.
This commit is contained in:
@@ -337,8 +337,8 @@ bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx) {
|
||||
// First fill transaction with our data without signing,
|
||||
// so external signers are not asked to sign more than once.
|
||||
bool complete;
|
||||
wallet.FillPSBT(psbtx, complete, std::nullopt, /*sign=*/false, /*bip32derivs=*/true);
|
||||
auto err{wallet.FillPSBT(psbtx, complete, std::nullopt, /*sign=*/true, /*bip32derivs=*/false)};
|
||||
wallet.FillPSBT(psbtx, {.sign = false, .bip32_derivs = true}, complete);
|
||||
auto err{wallet.FillPSBT(psbtx, {.sign = true, .bip32_derivs = false}, complete)};
|
||||
if (err) return false;
|
||||
complete = FinalizeAndExtractPSBT(psbtx, mtx);
|
||||
return complete;
|
||||
|
||||
Reference in New Issue
Block a user