aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2014-03-28 09:58:40 -0700
committerGregory Maxwell <greg@xiph.org>2014-03-28 09:58:40 -0700
commita60ab0ba89289433563c4c0993904acbca8c99ff (patch)
tree133b97141d6fc862604f0f2a59a5c7fd4856c5f8 /src/wallet.h
parent1294cdc43fd7de6cddd1405148f813d95994302f (diff)
downloadbitcoin-a60ab0ba89289433563c4c0993904acbca8c99ff.tar.xz
Make GetAvailableCredit run GetHash() only once per transaction.
This makes the first getbalance/getinfo 63x faster on my wallet.
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wallet.h b/src/wallet.h
index e2e89fffe7..487c258a20 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -620,9 +620,10 @@ public:
return nAvailableCreditCached;
int64_t nCredit = 0;
+ uint256 hashTx = GetHash();
for (unsigned int i = 0; i < vout.size(); i++)
{
- if (!pwallet->IsSpent(GetHash(), i))
+ if (!pwallet->IsSpent(hashTx, i))
{
const CTxOut &txout = vout[i];
nCredit += pwallet->GetCredit(txout);