mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Ensure wallet is unlocked before signing in walletprocesspsbt
This commit is contained in:
parent
09cb5ec6c8
commit
0e895212bb
1 changed files with 4 additions and 1 deletions
|
@ -4420,7 +4420,7 @@ static RPCHelpMan walletprocesspsbt()
|
|||
HELP_REQUIRING_PASSPHRASE,
|
||||
{
|
||||
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
|
||||
{"sign", RPCArg::Type::BOOL, RPCArg::Default{true}, "Also sign the transaction when updating"},
|
||||
{"sign", RPCArg::Type::BOOL, RPCArg::Default{true}, "Also sign the transaction when updating (requires wallet to be unlocked)"},
|
||||
{"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT"}, "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
|
||||
" \"DEFAULT\"\n"
|
||||
" \"ALL\"\n"
|
||||
|
@ -4467,6 +4467,9 @@ static RPCHelpMan walletprocesspsbt()
|
|||
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
|
||||
bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
|
||||
bool complete = true;
|
||||
|
||||
if (sign) EnsureWalletIsUnlocked(*pwallet);
|
||||
|
||||
const TransactionError err{wallet.FillPSBT(psbtx, complete, nHashType, sign, bip32derivs)};
|
||||
if (err != TransactionError::OK) {
|
||||
throw JSONRPCTransactionError(err);
|
||||
|
|
Loading…
Add table
Reference in a new issue