mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-11 16:17:54 +02:00
psbt: Check sighash types in SignPSBTInput and take sighash as optional
This commit is contained in:
@@ -163,7 +163,7 @@ static std::vector<RPCArg> CreateTxDoc()
|
||||
|
||||
// Update PSBT with information from the mempool, the UTXO set, the txindex, and the provided descriptors.
|
||||
// Optionally, sign the inputs that we can using information from the descriptors.
|
||||
PartiallySignedTransaction ProcessPSBT(const std::string& psbt_string, const std::any& context, const HidingSigningProvider& provider, int sighash_type, bool finalize)
|
||||
PartiallySignedTransaction ProcessPSBT(const std::string& psbt_string, const std::any& context, const HidingSigningProvider& provider, std::optional<int> sighash_type, bool finalize)
|
||||
{
|
||||
// Unserialize the transactions
|
||||
PartiallySignedTransaction psbtx;
|
||||
@@ -244,7 +244,7 @@ PartiallySignedTransaction ProcessPSBT(const std::string& psbt_string, const std
|
||||
UpdatePSBTOutput(provider, psbtx, i);
|
||||
}
|
||||
|
||||
RemoveUnnecessaryTransactions(psbtx, /*sighash_type=*/1);
|
||||
RemoveUnnecessaryTransactions(psbtx, /*sighash_type=*/std::nullopt);
|
||||
|
||||
return psbtx;
|
||||
}
|
||||
@@ -1796,7 +1796,7 @@ static RPCHelpMan utxoupdatepsbt()
|
||||
request.params[0].get_str(),
|
||||
request.context,
|
||||
HidingSigningProvider(&provider, /*hide_secret=*/true, /*hide_origin=*/false),
|
||||
/*sighash_type=*/SIGHASH_ALL,
|
||||
/*sighash_type=*/std::nullopt,
|
||||
/*finalize=*/false);
|
||||
|
||||
DataStream ssTx{};
|
||||
@@ -2063,7 +2063,7 @@ RPCHelpMan descriptorprocesspsbt()
|
||||
EvalDescriptorStringOrObject(descs[i], provider, /*expand_priv=*/true);
|
||||
}
|
||||
|
||||
int sighash_type = ParseSighashString(request.params[2]);
|
||||
std::optional<int> sighash_type = ParseSighashString(request.params[2]);
|
||||
bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
|
||||
bool finalize = request.params[4].isNull() ? true : request.params[4].get_bool();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user