Ensure wallet is unlocked before signing in walletprocesspsbt
This commit is contained in:
1 parent
09cb5ec6c8
commit
0e895212bb
1 file changed
+4
-1
@@ -4420,7 +4420,7 @@ static RPCHelpMan walletprocesspsbt()
|
|||||||
HELP_REQUIRING_PASSPHRASE,
|
HELP_REQUIRING_PASSPHRASE,
|
||||||
{
|
{
|
||||||
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
|
{"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"
|
{"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"
|
" \"DEFAULT\"\n"
|
||||||
" \"ALL\"\n"
|
" \"ALL\"\n"
|
||||||
@@ -4467,6 +4467,9 @@ static RPCHelpMan walletprocesspsbt()
|
|||||||
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
|
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 bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
|
|
||||||
|
if (sign) EnsureWalletIsUnlocked(*pwallet);
|
||||||
|
|
||||||
const TransactionError err{wallet.FillPSBT(psbtx, complete, nHashType, sign, bip32derivs)};
|
const TransactionError err{wallet.FillPSBT(psbtx, complete, nHashType, sign, bip32derivs)};
|
||||||
if (err != TransactionError::OK) {
|
if (err != TransactionError::OK) {
|
||||||
throw JSONRPCTransactionError(err);
|
throw JSONRPCTransactionError(err);
|
||||||
|
|||||||
Reference in new issue
Block a user