Skip to content

Commit 0e89521

Browse files
committed
Ensure wallet is unlocked before signing in walletprocesspsbt
1 parent 09cb5ec commit 0e89521

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4420,7 +4420,7 @@ static RPCHelpMan walletprocesspsbt()
44204420
HELP_REQUIRING_PASSPHRASE,
44214421
{
44224422
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
4423-
{"sign", RPCArg::Type::BOOL, RPCArg::Default{true}, "Also sign the transaction when updating"},
4423+
{"sign", RPCArg::Type::BOOL, RPCArg::Default{true}, "Also sign the transaction when updating (requires wallet to be unlocked)"},
44244424
{"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"
44254425
" \"DEFAULT\"\n"
44264426
" \"ALL\"\n"
@@ -4467,6 +4467,9 @@ static RPCHelpMan walletprocesspsbt()
44674467
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
44684468
bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
44694469
bool complete = true;
4470+
4471+
if (sign) EnsureWalletIsUnlocked(*pwallet);
4472+
44704473
const TransactionError err{wallet.FillPSBT(psbtx, complete, nHashType, sign, bip32derivs)};
44714474
if (err != TransactionError::OK) {
44724475
throw JSONRPCTransactionError(err);

0 commit comments

Comments
 (0)