aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-11-13 23:52:37 +0100
committerLuke Dashjr <luke-jr+git@utopios.org>2012-11-16 18:47:41 +0000
commit2a333587bdd4d77a96cbcf1166310af4aee7efeb (patch)
tree2307f8d087e048283ff7c3e5d3882d35364e6acf /src/wallet.cpp
parentacbdc055603905d3a9221662799e6b29df4bc1af (diff)
downloadbitcoin-2a333587bdd4d77a96cbcf1166310af4aee7efeb.tar.xz
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.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 1cfc6cab0c..5fceea7633 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;
}