mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Removed implicit CTransaction constructor from tests
This commit is contained in:
@@ -159,7 +159,7 @@ static void TestPackageSelection(const CChainParams& chainparams, const CScript&
|
||||
// Test that packages above the min relay fee do get included, even if one
|
||||
// of the transactions is below the min relay fee
|
||||
// Remove the low fee transaction and replace with a higher fee transaction
|
||||
mempool.removeRecursive(tx);
|
||||
mempool.removeRecursive(CTransaction(tx));
|
||||
tx.vout[0].nValue -= 2; // Now we should be just over the min relay fee
|
||||
hashLowFeeTx = tx.GetHash();
|
||||
mempool.addUnchecked(entry.Fee(feeToUse+2).FromTx(tx));
|
||||
@@ -441,9 +441,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
tx.nLockTime = 0;
|
||||
hash = tx.GetHash();
|
||||
mempool.addUnchecked(entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
|
||||
BOOST_CHECK(CheckFinalTx(tx, flags)); // Locktime passes
|
||||
BOOST_CHECK(!TestSequenceLocks(tx, flags)); // Sequence locks fail
|
||||
BOOST_CHECK(SequenceLocks(tx, flags, &prevheights, CreateBlockIndex(chainActive.Tip()->nHeight + 2))); // Sequence locks pass on 2nd block
|
||||
BOOST_CHECK(CheckFinalTx(CTransaction(tx), flags)); // Locktime passes
|
||||
BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks fail
|
||||
BOOST_CHECK(SequenceLocks(CTransaction(tx), flags, &prevheights, CreateBlockIndex(chainActive.Tip()->nHeight + 2))); // Sequence locks pass on 2nd block
|
||||
|
||||
// relative time locked
|
||||
tx.vin[0].prevout.hash = txFirst[1]->GetHash();
|
||||
@@ -451,12 +451,12 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
prevheights[0] = baseheight + 2;
|
||||
hash = tx.GetHash();
|
||||
mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx));
|
||||
BOOST_CHECK(CheckFinalTx(tx, flags)); // Locktime passes
|
||||
BOOST_CHECK(!TestSequenceLocks(tx, flags)); // Sequence locks fail
|
||||
BOOST_CHECK(CheckFinalTx(CTransaction(tx), flags)); // Locktime passes
|
||||
BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks fail
|
||||
|
||||
for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++)
|
||||
chainActive.Tip()->GetAncestor(chainActive.Tip()->nHeight - i)->nTime += 512; //Trick the MedianTimePast
|
||||
BOOST_CHECK(SequenceLocks(tx, flags, &prevheights, CreateBlockIndex(chainActive.Tip()->nHeight + 1))); // Sequence locks pass 512 seconds later
|
||||
BOOST_CHECK(SequenceLocks(CTransaction(tx), flags, &prevheights, CreateBlockIndex(chainActive.Tip()->nHeight + 1))); // Sequence locks pass 512 seconds later
|
||||
for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++)
|
||||
chainActive.Tip()->GetAncestor(chainActive.Tip()->nHeight - i)->nTime -= 512; //undo tricked MTP
|
||||
|
||||
@@ -467,9 +467,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
tx.nLockTime = chainActive.Tip()->nHeight + 1;
|
||||
hash = tx.GetHash();
|
||||
mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx));
|
||||
BOOST_CHECK(!CheckFinalTx(tx, flags)); // Locktime fails
|
||||
BOOST_CHECK(TestSequenceLocks(tx, flags)); // Sequence locks pass
|
||||
BOOST_CHECK(IsFinalTx(tx, chainActive.Tip()->nHeight + 2, chainActive.Tip()->GetMedianTimePast())); // Locktime passes on 2nd block
|
||||
BOOST_CHECK(!CheckFinalTx(CTransaction(tx), flags)); // Locktime fails
|
||||
BOOST_CHECK(TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks pass
|
||||
BOOST_CHECK(IsFinalTx(CTransaction(tx), chainActive.Tip()->nHeight + 2, chainActive.Tip()->GetMedianTimePast())); // Locktime passes on 2nd block
|
||||
|
||||
// absolute time locked
|
||||
tx.vin[0].prevout.hash = txFirst[3]->GetHash();
|
||||
@@ -478,23 +478,23 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
prevheights[0] = baseheight + 4;
|
||||
hash = tx.GetHash();
|
||||
mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx));
|
||||
BOOST_CHECK(!CheckFinalTx(tx, flags)); // Locktime fails
|
||||
BOOST_CHECK(TestSequenceLocks(tx, flags)); // Sequence locks pass
|
||||
BOOST_CHECK(IsFinalTx(tx, chainActive.Tip()->nHeight + 2, chainActive.Tip()->GetMedianTimePast() + 1)); // Locktime passes 1 second later
|
||||
BOOST_CHECK(!CheckFinalTx(CTransaction(tx), flags)); // Locktime fails
|
||||
BOOST_CHECK(TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks pass
|
||||
BOOST_CHECK(IsFinalTx(CTransaction(tx), chainActive.Tip()->nHeight + 2, chainActive.Tip()->GetMedianTimePast() + 1)); // Locktime passes 1 second later
|
||||
|
||||
// mempool-dependent transactions (not added)
|
||||
tx.vin[0].prevout.hash = hash;
|
||||
prevheights[0] = chainActive.Tip()->nHeight + 1;
|
||||
tx.nLockTime = 0;
|
||||
tx.vin[0].nSequence = 0;
|
||||
BOOST_CHECK(CheckFinalTx(tx, flags)); // Locktime passes
|
||||
BOOST_CHECK(TestSequenceLocks(tx, flags)); // Sequence locks pass
|
||||
BOOST_CHECK(CheckFinalTx(CTransaction(tx), flags)); // Locktime passes
|
||||
BOOST_CHECK(TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks pass
|
||||
tx.vin[0].nSequence = 1;
|
||||
BOOST_CHECK(!TestSequenceLocks(tx, flags)); // Sequence locks fail
|
||||
BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks fail
|
||||
tx.vin[0].nSequence = CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG;
|
||||
BOOST_CHECK(TestSequenceLocks(tx, flags)); // Sequence locks pass
|
||||
BOOST_CHECK(TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks pass
|
||||
tx.vin[0].nSequence = CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG | 1;
|
||||
BOOST_CHECK(!TestSequenceLocks(tx, flags)); // Sequence locks fail
|
||||
BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags)); // Sequence locks fail
|
||||
|
||||
BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user