Changeset View
Changeset View
Standalone View
Standalone View
src/test/undo_tests.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(connect_utxo_extblock) { | ||||
tx.vout.resize(1); | tx.vout.resize(1); | ||||
tx.vout[0].nValue = Amount(42); | tx.vout[0].nValue = Amount(42); | ||||
auto coinbaseTx = CTransaction(tx); | auto coinbaseTx = CTransaction(tx); | ||||
block.vtx.resize(2); | block.vtx.resize(2); | ||||
block.vtx[0] = MakeTransactionRef(tx); | block.vtx[0] = MakeTransactionRef(tx); | ||||
tx.vout[0].scriptPubKey = CScript() << OP_TRUE; | tx.vout[0].scriptPubKey = CScript() << OP_TRUE; | ||||
tx.vin[0].prevout.hash = InsecureRand256(); | tx.vin[0].prevout = COutPoint(InsecureRand256(), 0); | ||||
tx.vin[0].prevout.n = 0; | |||||
tx.vin[0].nSequence = CTxIn::SEQUENCE_FINAL; | tx.vin[0].nSequence = CTxIn::SEQUENCE_FINAL; | ||||
tx.vin[0].scriptSig.resize(0); | tx.vin[0].scriptSig.resize(0); | ||||
tx.nVersion = 2; | tx.nVersion = 2; | ||||
auto prevTx0 = CTransaction(tx); | auto prevTx0 = CTransaction(tx); | ||||
AddCoins(view, prevTx0, 100); | AddCoins(view, prevTx0, 100); | ||||
tx.vin[0].prevout.hash = prevTx0.GetId(); | tx.vin[0].prevout = COutPoint(prevTx0.GetId(), 0); | ||||
auto tx0 = CTransaction(tx); | auto tx0 = CTransaction(tx); | ||||
block.vtx[1] = MakeTransactionRef(tx0); | block.vtx[1] = MakeTransactionRef(tx0); | ||||
// Now update the UTXO set. | // Now update the UTXO set. | ||||
CBlockUndo blockundo; | CBlockUndo blockundo; | ||||
UpdateUTXOSet(block, view, blockundo, chainparams, 123456); | UpdateUTXOSet(block, view, blockundo, chainparams, 123456); | ||||
BOOST_CHECK(view.GetBestBlock() == block.GetHash()); | BOOST_CHECK(view.GetBestBlock() == block.GetHash()); | ||||
Show All 13 Lines |