From d2e93f94275471596616cbe661565b97682953f3 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 15 Feb 2016 11:35:28 -0500 Subject: [PATCH] Make walletpassphrase with timeout=0 never lock the wallet. This broke when the Unlock API changed to replace the timeout in seconds with a time.Time channel. --- rpc/legacyrpc/methods.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpc/legacyrpc/methods.go b/rpc/legacyrpc/methods.go index 243f8d2c1b..c785aab387 100644 --- a/rpc/legacyrpc/methods.go +++ b/rpc/legacyrpc/methods.go @@ -1956,7 +1956,11 @@ func WalletPassphrase(icmd interface{}, w *wallet.Wallet) (interface{}, error) { cmd := icmd.(*btcjson.WalletPassphraseCmd) timeout := time.Second * time.Duration(cmd.Timeout) - err := w.Unlock([]byte(cmd.Passphrase), time.After(timeout)) + var unlockAfter <-chan time.Time + if timeout != 0 { + unlockAfter = time.After(timeout) + } + err := w.Unlock([]byte(cmd.Passphrase), unlockAfter) return nil, err }