Will calling "walletpassphrase" twice in a short amount of time increase the time the wallet stays unlocked?

4

The Bitcoin API call for walletpassphrase allows one to open the wallet for a set amount of time. If one calls it again while the wallet is still unlocked, we get an error of 'Error: Wallet is already unlocked.'. Does the call extend the amount of time the wallet is unlocked, or not?

ThePiachu

Posted 2012-06-28T00:52:50.113

Reputation: 41 594

Answers

3

After doing some experiments it appears that as calling the function results in an error, it is not processed, and thus the unlock time is not extended.

ThePiachu

Posted 2012-06-28T00:52:50.113

Reputation: 41 594

2

Right. And that's quite annoying functionality. If I want to make a payment, I run the unlock command, then make the payment. If it happens that the wallet was already unlocked, but was due to lock again 1 second later, the unlock call fails, and then the wallet has locked itself before I can make the payment. I just reported a github issue about this: https://github.com/bitcoin/bitcoin/issues/1528 because it has been annoying me for some time.

Chris Moore 2012-06-28T02:35:06.277

1

@ChrisMoore I also posted the issue earlier - https://github.com/bitcoin/bitcoin/issues/1527 .

ThePiachu 2012-06-28T12:11:45.247

Ugly workarounds: call walletlock before walletpassphrase.

Or call getinfo to see if the wallet is unlocked (and get the time of when it will be locked again) – gavinandresen 2012-06-29T18:25:54.970