Browse Source

Add CWallet::ReorderTransactions and use in accounting_tests.cpp

0.14
Patrick Strateman 8 years ago
parent
commit
d2e678d7d2
  1. 2
      src/wallet/test/accounting_tests.cpp
  2. 6
      src/wallet/wallet.cpp
  3. 1
      src/wallet/wallet.h

2
src/wallet/test/accounting_tests.cpp

@ -22,7 +22,7 @@ GetResults(CWalletDB& walletdb, std::map<CAmount, CAccountingEntry>& results)
std::list<CAccountingEntry> aes; std::list<CAccountingEntry> aes;
results.clear(); results.clear();
BOOST_CHECK(walletdb.ReorderTransactions(pwalletMain) == DB_LOAD_OK); BOOST_CHECK(pwalletMain->ReorderTransactions() == DB_LOAD_OK);
pwalletMain->ListAccountCreditDebit("", aes); pwalletMain->ListAccountCreditDebit("", aes);
BOOST_FOREACH(CAccountingEntry& ae, aes) BOOST_FOREACH(CAccountingEntry& ae, aes)
{ {

6
src/wallet/wallet.cpp

@ -649,6 +649,12 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
return true; return true;
} }
DBErrors CWallet::ReorderTransactions()
{
CWalletDB walletdb(strWalletFile);
return walletdb.ReorderTransactions(this);
}
int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb) int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb)
{ {
AssertLockHeld(cs_wallet); // nOrderPosNext AssertLockHeld(cs_wallet); // nOrderPosNext

1
src/wallet/wallet.h

@ -741,6 +741,7 @@ public:
* @return next transaction order id * @return next transaction order id
*/ */
int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL); int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL);
DBErrors ReorderTransactions();
bool AccountMove(std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment = ""); bool AccountMove(std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment = "");
bool GetAccountPubkey(CPubKey &pubKey, std::string strAccount, bool bForceNew = false); bool GetAccountPubkey(CPubKey &pubKey, std::string strAccount, bool bForceNew = false);

Loading…
Cancel
Save