diff options
| author | Luke Dashjr <[email protected]> | 2015-10-19 09:19:38 +0000 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2015-11-21 01:48:25 +0000 |
| commit | 3e7c89196ceb2742b62cd183d6fab74edc40647a (patch) | |
| tree | e1e14d18e88a0a88015e7c3c4642659b3b018487 /src/wallet/walletdb.cpp | |
| parent | Merge pull request #7026 (diff) | |
| download | discoin-3e7c89196ceb2742b62cd183d6fab74edc40647a.tar.xz discoin-3e7c89196ceb2742b62cd183d6fab74edc40647a.zip | |
Optimisation: Store transaction list order in memory rather than compute it every need
Huge performance improvement (450%) for zapwallettxes
Diffstat (limited to 'src/wallet/walletdb.cpp')
| -rw-r--r-- | src/wallet/walletdb.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index ea8a4eb04..9ce9f53bd 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -191,7 +191,7 @@ bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccount return Write(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry); } -bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry) +bool CWalletDB::WriteAccountingEntry_Backend(const CAccountingEntry& acentry) { return WriteAccountingEntry(++nAccountingEntryNumber, acentry); } @@ -709,6 +709,12 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) if (wss.fAnyUnordered) result = ReorderTransactions(pwallet); + pwallet->laccentries.clear(); + ListAccountCreditDebit("*", pwallet->laccentries); + BOOST_FOREACH(CAccountingEntry& entry, pwallet->laccentries) { + pwallet->wtxOrdered.insert(make_pair(entry.nOrderPos, CWallet::TxPair((CWalletTx*)0, &entry))); + } + return result; } |