aboutsummaryrefslogtreecommitdiff
path: root/src/rpcwallet.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-02-15 16:38:28 -0500
committerGavin Andresen <gavinandresen@gmail.com>2014-02-26 11:53:51 -0500
commit93a18a3650292afbb441a47d1fa1b94aeb0164e3 (patch)
tree36382e2077820d469fd1257ee35375a86206a878 /src/rpcwallet.cpp
parenta16ad1c0f465935d437bd9ae9875b28be49ec65b (diff)
downloadbitcoin-93a18a3650292afbb441a47d1fa1b94aeb0164e3.tar.xz
Remove CWalletTx::vfSpent
Use the spent outpoint multimap to figure out which wallet transaction outputs are unspent, instead of a vfSpent array that is saved to disk.
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r--src/rpcwallet.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index 7b605af589..d3b6c349a7 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -560,7 +560,7 @@ int64_t GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMi
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
- if (!IsFinalTx(wtx))
+ if (!IsFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0)
continue;
int64_t nReceived, nSent, nFee;
@@ -1324,13 +1324,14 @@ Value listaccounts(const Array& params, bool fHelp)
string strSentAccount;
list<pair<CTxDestination, int64_t> > listReceived;
list<pair<CTxDestination, int64_t> > listSent;
- if (wtx.GetBlocksToMaturity() > 0)
+ int nDepth = wtx.GetDepthInMainChain();
+ if (wtx.GetBlocksToMaturity() > 0 || nDepth < 0)
continue;
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount);
mapAccountBalances[strSentAccount] -= nFee;
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& s, listSent)
mapAccountBalances[strSentAccount] -= s.second;
- if (wtx.GetDepthInMainChain() >= nMinDepth)
+ if (nDepth >= nMinDepth)
{
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& r, listReceived)
if (pwalletMain->mapAddressBook.count(r.first))