mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-07 21:28:40 +02:00
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:
@@ -2101,11 +2101,12 @@ bool CWallet::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<PSBTError> CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& complete, int sighash_type, bool sign, bool bip32derivs, size_t * n_signed, bool finalize) const
|
||||
std::optional<PSBTError> CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& complete, std::optional<int> sighash_type, bool sign, bool bip32derivs, size_t * n_signed, bool finalize) const
|
||||
{
|
||||
if (n_signed) {
|
||||
*n_signed = 0;
|
||||
}
|
||||
if (!sighash_type) sighash_type = SIGHASH_DEFAULT;
|
||||
LOCK(cs_wallet);
|
||||
// Get all of the previous transactions
|
||||
for (unsigned int i = 0; i < psbtx.tx->vin.size(); ++i) {
|
||||
@@ -2144,7 +2145,7 @@ std::optional<PSBTError> CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bo
|
||||
}
|
||||
}
|
||||
|
||||
RemoveUnnecessaryTransactions(psbtx, sighash_type);
|
||||
RemoveUnnecessaryTransactions(psbtx, *sighash_type);
|
||||
|
||||
// Complete if every input is now signed
|
||||
complete = true;
|
||||
|
||||
Reference in New Issue
Block a user