From 4291e8feab308cb9c7840d74fc7aacf137a7c21f Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 13 Nov 2012 23:52:37 +0100 Subject: Prevent RPC 'move' from deadlocking It seemed to create two CWalletDB objects that both grab the database lock. --- src/wallet.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/wallet.cpp') 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; } -- cgit v1.2.3