diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-13 23:52:37 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-14 00:31:56 +0100 |
commit | 4291e8feab308cb9c7840d74fc7aacf137a7c21f (patch) | |
tree | fd2376f4546dfd496dbd8367e5536ee47dae5304 /src/wallet.cpp | |
parent | eb49457ff279721cc3cef10fe68fd75b4aa71833 (diff) |
Prevent RPC 'move' from deadlocking
It seemed to create two CWalletDB objects that both grab the
database lock.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 1a6a1082b1..3e3d5eac57 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -291,10 +291,14 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) return true; } -int64 CWallet::IncOrderPosNext() +int64 CWallet::IncOrderPosNext(CWalletDB *pwalletdb) { - int64 nRet = nOrderPosNext; - CWalletDB(strWalletFile).WriteOrderPosNext(++nOrderPosNext); + int64 nRet = nOrderPosNext++; + if (pwalletdb) { + pwalletdb->WriteOrderPosNext(nOrderPosNext); + } else { + CWalletDB(strWalletFile).WriteOrderPosNext(nOrderPosNext); + } return nRet; } |