Replace the sign
, finalize
, bip32derivs
and sighash_type
arguments that are passed to FillPSBT()
and SignPSBTInput()
with a PSBTFillOptions
struct.
0struct PSBTFillOptions {
1 bool sign{true};
2 std::optional<int> sighash_type{std::nullopt};
3 bool finalize{true};
4 bool bip32_derivs{true};
5};
Additionally this PR introduces:
0struct SignOptions {
1 int sighash_type{SIGHASH_DEFAULT};
2};
This is used by SignTransaction
and the MutableTransactionSignatureCreator
constructor.
These changes make 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.
The options
structs are usually passed inline, except in src/rpc/rawtransaction_util.cpp
where otherwise LLVM 16 gets confused.