Add CMutableTransaction and make CTransaction immutable.
In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
This commit is contained in:
@@ -83,13 +83,21 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
|
||||
|
||||
|
||||
wtx.mapValue["comment"] = "y";
|
||||
--wtx.nLockTime; // Just to change the hash :)
|
||||
{
|
||||
CMutableTransaction tx(wtx);
|
||||
--tx.nLockTime; // Just to change the hash :)
|
||||
*static_cast<CTransaction*>(&wtx) = CTransaction(tx);
|
||||
}
|
||||
pwalletMain->AddToWallet(wtx);
|
||||
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]);
|
||||
vpwtx[1]->nTimeReceived = (unsigned int)1333333336;
|
||||
|
||||
wtx.mapValue["comment"] = "x";
|
||||
--wtx.nLockTime; // Just to change the hash :)
|
||||
{
|
||||
CMutableTransaction tx(wtx);
|
||||
--tx.nLockTime; // Just to change the hash :)
|
||||
*static_cast<CTransaction*>(&wtx) = CTransaction(tx);
|
||||
}
|
||||
pwalletMain->AddToWallet(wtx);
|
||||
vpwtx.push_back(&pwalletMain->mapWallet[wtx.GetHash()]);
|
||||
vpwtx[2]->nTimeReceived = (unsigned int)1333333329;
|
||||
|
||||
Reference in New Issue
Block a user