reddcoin-project / reddcoin-3.10

Reddcoin: the digital social currency
http://www.reddcoin.com
MIT License
287 stars 114 forks source link

Staking mode with RPC calls (urgent?) #41

Closed samvaughton closed 3 years ago

samvaughton commented 10 years ago

If I describe the scenario it will be easier:

  1. I unlock my wallet into staking mode with walletpassphrase [pass] [timeout] true
  2. Now, I want to send some coins, so I use sendtoaddress.
  3. I will receive the code -13 error which is RPC_WALLET_UNLOCK_NEEDED.
  4. So I then perform a walletpassphrase [pass] 1 false call to unlock it quickly for a send command.
  5. The daemon will return an error code of -17 which is RPC_WALLET_ALREADY_UNLOCKED.

This means the process to be able to stake and send a coin will be to:

  1. Lock the wallet from staking mode
  2. Unlock the wallet fully briefly
  3. Send the coins
  4. Lock the wallet fully
  5. Reunlock the wallet in staking mode

As you can see this is a tedious process and is actually impossible anyway since I cannot tell if we are in "staking" mode except for tracking the state myself. Which is not the solution since these are RPC calls for everyone and should be handled as such. The state in getstakinginfo.enabled can be true when the wallet is unlocked fully or just staking which does not help.

Solutions to solve this?

I would also think we need a field for the states of the wallet ie locked, unlocked, staking.

I know my previous issues conflict with this but I didn't foresee it and it seems we need to improve upon this whole scenario.

samvaughton commented 10 years ago

One solution would be to accept the passphrase in the walletpassphrase [pass] 1 false call to unlock it fully for that period of time before reverting to the staking mode again?

laudney commented 10 years ago

It now returns a new error code -18 to help you figure out the initial state: https://github.com/reddcoin-project/reddcoin/commit/9e0982ad82df6b17847147a9c2026eef25a7cd27