When sending money via the daemon and the wallet is locked it will throw an RPC error code of RPC_WALLET_UNLOCK_NEEDED which is -13.
When the wallet is staking only locked it will throw an error code of RPC_WALLET_ERROR which is -4.
This generic wallet error code that does not help me to distinguish the type of error (apart from comparing strings which I do not want to do). To be able to prompt the user to enter a password for to send coins in staking mode I need the code to be either -13 or a new RPC code introduced.
I've taken a look at the source code, but don't feel comfortable trying this and I don't know the best option to take. But it looks as if the actual wallet.cpp SendMoney function produces this generic error.
In the RPC command sendtoaddress there is this snippet:
if (pwalletMain->IsLocked())
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
I would assume just adding an or condition with pwalletMain->fWalletUnlockStakingOnly would work but I am not confident and need to properly read the codebase before I do any pull requests.
When sending money via the daemon and the wallet is locked it will throw an RPC error code of
RPC_WALLET_UNLOCK_NEEDED
which is-13
.When the wallet is staking only locked it will throw an error code of
RPC_WALLET_ERROR
which is-4
.This generic wallet error code that does not help me to distinguish the type of error (apart from comparing strings which I do not want to do). To be able to prompt the user to enter a password for to send coins in staking mode I need the code to be either
-13
or a new RPC code introduced.I've taken a look at the source code, but don't feel comfortable trying this and I don't know the best option to take. But it looks as if the actual wallet.cpp
SendMoney
function produces this generic error.In the RPC command
sendtoaddress
there is this snippet:I would assume just adding an or condition with
pwalletMain->fWalletUnlockStakingOnly
would work but I am not confident and need to properly read the codebase before I do any pull requests.Thoughts on this?