[Wallet] Remove last external reference to CWalletDB #8696

pull pstratem wants to merge 4 commits into bitcoin:master from pstratem:2016-09-09-cwallet-listaccountcreditdebit changing 3 files +37 −18
  1. pstratem commented at 2:27 AM on September 10, 2016: contributor

    This removes the CWalletDB references in account_tests.cpp by adding passthrough functions in CWallet

  2. luke-jr commented at 3:07 AM on September 10, 2016: member

    ThreadFlushWalletDB is started from init still, no?

  3. pstratem commented at 3:10 AM on September 10, 2016: contributor

    @luke-jr yes but that doesn't use CWalletDB and handles something having the database open already just fine.

    The goal here is to cache the CWalletDB across nested CWallet calls to avoid performance issues. (Similar to what the initial wallet encryption logic does).

  4. fanquake added the label Wallet on Sep 10, 2016
  5. MarcoFalke commented at 11:32 AM on September 11, 2016: member

    utACK 461a760

  6. jonasschnelli commented at 9:37 AM on September 12, 2016: contributor

    utACK 461a7600664fe771964fc0bf153004c087bd8004

  7. in src/wallet/wallet.h:None in 461a760066 outdated
     737 | @@ -738,6 +738,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
     738 |       * @return next transaction order id
     739 |       */
     740 |      int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL);
     741 | +    DBErrors ReorderTransactions();
    


    TheBlueMatt commented at 1:55 PM on September 13, 2016:

    Would be kind of nice to not expose DBErrors further from wallet, though I would still call this a strict improvement.


    pstratem commented at 12:38 PM on September 15, 2016:

    DBErrors is already exposed in CWallet::LoadWallet I'll probably change that later

  8. in src/wallet/wallet.cpp:None in 461a760066 outdated
     691 | @@ -686,7 +692,7 @@ bool CWallet::AccountMove(std::string strFrom, std::string strTo, CAmount nAmoun
     692 |      credit.nTime = nNow;
     693 |      credit.strOtherAccount = strFrom;
     694 |      credit.strComment = strComment;
     695 | -    AddAccountingEntry(credit, walletdb);
     696 | +    AddAccountingEntry(credit);
    


    TheBlueMatt commented at 2:04 PM on September 13, 2016:

    Does this lose atomicity? Could duplicate the function to add a wrapper which does not require the walletdb pointer?


    pstratem commented at 4:02 PM on September 15, 2016:

    I've made AccountMove atomic again by overloading AddAccountingEntry

  9. pstratem force-pushed on Sep 15, 2016
  10. Add CWallet::ListAccountCreditDebit
    Simple pass through for CWalletDB::ListAccountCreditDebit
    59adc86680
  11. Add CWallet::ReorderTransactions and use in accounting_tests.cpp d2e678d7d2
  12. pstratem force-pushed on Sep 15, 2016
  13. Remove pwalletdb parameter from CWallet::AddAccountingEntry 02e2a81536
  14. Remove last reference to CWalletDB from accounting_tests.cpp 2ca6b9df1d
  15. pstratem force-pushed on Sep 15, 2016
  16. in src/wallet/wallet.h:None in 2ca6b9df1d
     775 | @@ -775,7 +776,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
     776 |                             std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true);
     777 |      bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CConnman* connman);
     778 |  
     779 | -    bool AddAccountingEntry(const CAccountingEntry&, CWalletDB & pwalletdb);
     780 | +    void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& entries);
     781 | +    bool AddAccountingEntry(const CAccountingEntry&);
     782 | +    bool AddAccountingEntry(const CAccountingEntry&, CWalletDB *pwalletdb);
    


    laanwj commented at 10:05 AM on September 20, 2016:

    Can this one be private?


    pstratem commented at 10:07 AM on September 20, 2016:

    Maybe, I'm going to go through all of the API calls and make things which can be private private as a sweep.

    I'd rather fix this then.


    laanwj commented at 10:46 AM on September 20, 2016:

    OK, fair enough

  17. laanwj approved
  18. laanwj merged this on Sep 20, 2016
  19. laanwj closed this on Sep 20, 2016

  20. laanwj referenced this in commit a1f8d3ed95 on Sep 20, 2016
  21. laanwj commented at 10:47 AM on September 20, 2016: member

    utACK 2ca6b9d

  22. codablock referenced this in commit 2e90511bec on Sep 19, 2017
  23. codablock referenced this in commit 630c699f00 on Jan 11, 2018
  24. andvgal referenced this in commit 7a57516785 on Jan 6, 2019
  25. zkbot referenced this in commit 5b194067ea on Aug 12, 2021
  26. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me