psbt: Check sighash types in SignPSBTInput and take sighash as optional

This commit is contained in:
Ava Chow
2025-01-08 15:33:42 -05:00
parent a118256948
commit 4c7d767e49
10 changed files with 42 additions and 25 deletions

View File

@@ -378,10 +378,10 @@ UniValue DescribeAddress(const CTxDestination& dest)
*
* @pre The sighash argument should be string or null.
*/
int ParseSighashString(const UniValue& sighash)
std::optional<int> ParseSighashString(const UniValue& sighash)
{
if (sighash.isNull()) {
return SIGHASH_DEFAULT;
return std::nullopt;
}
const auto result{SighashFromStr(sighash.get_str())};
if (!result) {