Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/accounting_tests.cpp
Show All 36 Lines | BOOST_AUTO_TEST_CASE(acc_orderupgrade) { | ||||
ae.nCreditDebit = Amount(1); | ae.nCreditDebit = Amount(1); | ||||
ae.nTime = 1333333333; | ae.nTime = 1333333333; | ||||
ae.strOtherAccount = "b"; | ae.strOtherAccount = "b"; | ||||
ae.strComment = ""; | ae.strComment = ""; | ||||
pwalletMain->AddAccountingEntry(ae); | pwalletMain->AddAccountingEntry(ae); | ||||
wtx.mapValue["comment"] = "z"; | wtx.mapValue["comment"] = "z"; | ||||
pwalletMain->AddToWallet(wtx); | pwalletMain->AddToWallet(wtx); | ||||
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetId()]); | vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]); | ||||
vpwtx[0]->nTimeReceived = (unsigned int)1333333335; | vpwtx[0]->nTimeReceived = (unsigned int)1333333335; | ||||
vpwtx[0]->nOrderPos = -1; | vpwtx[0]->nOrderPos = -1; | ||||
ae.nTime = 1333333336; | ae.nTime = 1333333336; | ||||
ae.strOtherAccount = "c"; | ae.strOtherAccount = "c"; | ||||
pwalletMain->AddAccountingEntry(ae); | pwalletMain->AddAccountingEntry(ae); | ||||
GetResults(results); | GetResults(results); | ||||
Show All 24 Lines | BOOST_AUTO_TEST_CASE(acc_orderupgrade) { | ||||
wtx.mapValue["comment"] = "y"; | wtx.mapValue["comment"] = "y"; | ||||
{ | { | ||||
CMutableTransaction tx(wtx); | CMutableTransaction tx(wtx); | ||||
// Just to change the hash :) | // Just to change the hash :) | ||||
--tx.nLockTime; | --tx.nLockTime; | ||||
wtx.SetTx(MakeTransactionRef(std::move(tx))); | wtx.SetTx(MakeTransactionRef(std::move(tx))); | ||||
} | } | ||||
pwalletMain->AddToWallet(wtx); | pwalletMain->AddToWallet(wtx); | ||||
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetId()]); | vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]); | ||||
vpwtx[1]->nTimeReceived = (unsigned int)1333333336; | vpwtx[1]->nTimeReceived = (unsigned int)1333333336; | ||||
wtx.mapValue["comment"] = "x"; | wtx.mapValue["comment"] = "x"; | ||||
{ | { | ||||
CMutableTransaction tx(wtx); | CMutableTransaction tx(wtx); | ||||
// Just to change the hash :) | // Just to change the hash :) | ||||
--tx.nLockTime; | --tx.nLockTime; | ||||
wtx.SetTx(MakeTransactionRef(std::move(tx))); | wtx.SetTx(MakeTransactionRef(std::move(tx))); | ||||
} | } | ||||
pwalletMain->AddToWallet(wtx); | pwalletMain->AddToWallet(wtx); | ||||
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetId()]); | vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]); | ||||
vpwtx[2]->nTimeReceived = (unsigned int)1333333329; | vpwtx[2]->nTimeReceived = (unsigned int)1333333329; | ||||
vpwtx[2]->nOrderPos = -1; | vpwtx[2]->nOrderPos = -1; | ||||
GetResults(results); | GetResults(results); | ||||
BOOST_CHECK(results.size() == 3); | BOOST_CHECK(results.size() == 3); | ||||
BOOST_CHECK(pwalletMain->nOrderPosNext == 6); | BOOST_CHECK(pwalletMain->nOrderPosNext == 6); | ||||
BOOST_CHECK(0 == vpwtx[2]->nOrderPos); | BOOST_CHECK(0 == vpwtx[2]->nOrderPos); | ||||
Show All 28 Lines |