aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-09-08 04:55:36 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-09-08 04:55:36 +0000
commitda7b8c1260d91e3306eb18dd65633567cb31332f (patch)
tree1fad88d0c8f5bb0953887c268e9a5a55910931d8 /src/wallet.cpp
parentddb709e9de1490afcfa1af045517d2228d5b864c (diff)
downloadbitcoin-da7b8c1260d91e3306eb18dd65633567cb31332f.tar.xz
Bugfix: Initialize CWallet::nOrderPosNext on an empty wallet, and save it in db
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 3af9fdaeae..74c1112d60 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -291,6 +291,13 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
return true;
}
+int64 CWallet::IncOrderPosNext()
+{
+ int64 nRet = nOrderPosNext;
+ CWalletDB(strWalletFile).WriteOrderPosNext(++nOrderPosNext);
+ return nRet;
+}
+
CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount)
{
CWalletDB walletdb(strWalletFile);
@@ -362,7 +369,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
if (fInsertedNew)
{
wtx.nTimeReceived = GetAdjustedTime();
- wtx.nOrderPos = nOrderPosNext++;
+ wtx.nOrderPos = IncOrderPosNext();
wtx.nTimeSmart = wtx.nTimeReceived;
if (wtxIn.hashBlock != 0)