mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge bitcoin/bitcoin#22818: test: Activate all regtest softforks at height 1, unless overridden
fa4db8671btest: Activate all regtest softforks at height 1, unless overridden (MarcoFalke)faad1e5ffdIntroduce -testactivationheight=name@height setting (MarcoFalke)fadb2ef2fatest: Add extra_args argument to TestChain100Setup constructor (MarcoFalke)faa46986aatest: Remove version argument from build_next_block in p2p_segwit test (MarcoFalke)fa086ef539test: Remove unused ~TestChain100Setup (MarcoFalke) Pull request description: All softforks that are active at the tip of mainnet, should also be active from genesis in regtest. Otherwise their rules might not be enforced in user testing, thus making their testing less useful. To still allow tests to check pre-softfork rules, a runtime argument can change the activation height. ACKs for top commit: laanwj: Code review ACKfa4db8671btheStack: re-ACKfa4db8671bTree-SHA512: 6397d46ff56ebc48c007a4cda633904d6ac085bc76b4ecf83097c546c7eec93ac0c44b88083b2611b9091c8d1fb8ee1e314065de078ef15e922c015de7ade8bf
This commit is contained in:
@@ -13,6 +13,11 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
struct Dersig100Setup : public TestChain100Setup {
|
||||
Dersig100Setup()
|
||||
: TestChain100Setup{{"-testactivationheight=dersig@102"}} {}
|
||||
};
|
||||
|
||||
bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
|
||||
const CCoinsViewCache& inputs, unsigned int flags, bool cacheSigStore,
|
||||
bool cacheFullScriptStore, PrecomputedTransactionData& txdata,
|
||||
@@ -20,7 +25,7 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(txvalidationcache_tests)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
||||
BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
||||
{
|
||||
// Make sure skipping validation of transactions that were
|
||||
// validated going into the memory pool does not allow
|
||||
@@ -153,7 +158,7 @@ static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t fail
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
|
||||
BOOST_FIXTURE_TEST_CASE(checkinputs_test, Dersig100Setup)
|
||||
{
|
||||
// Test that passing CheckInputScripts with one set of script flags doesn't imply
|
||||
// that we would pass again with a different set of flags.
|
||||
|
||||
@@ -205,7 +205,8 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
||||
}
|
||||
}
|
||||
|
||||
TestChain100Setup::TestChain100Setup()
|
||||
TestChain100Setup::TestChain100Setup(const std::vector<const char*>& extra_args)
|
||||
: TestingSetup{CBaseChainParams::REGTEST, extra_args}
|
||||
{
|
||||
SetMockTime(1598887952);
|
||||
constexpr std::array<unsigned char, 32> vchKey = {
|
||||
@@ -321,11 +322,6 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio
|
||||
return mempool_txn;
|
||||
}
|
||||
|
||||
TestChain100Setup::~TestChain100Setup()
|
||||
{
|
||||
gArgs.ForceSetArg("-segwitheight", "0");
|
||||
}
|
||||
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) const
|
||||
{
|
||||
return FromTx(MakeTransactionRef(tx));
|
||||
|
||||
@@ -113,8 +113,8 @@ class CScript;
|
||||
/**
|
||||
* Testing fixture that pre-creates a 100-block REGTEST-mode block chain
|
||||
*/
|
||||
struct TestChain100Setup : public RegTestingSetup {
|
||||
TestChain100Setup();
|
||||
struct TestChain100Setup : public TestingSetup {
|
||||
TestChain100Setup(const std::vector<const char*>& extra_args = {});
|
||||
|
||||
/**
|
||||
* Create a new block with just given transactions, coinbase paying to
|
||||
@@ -156,8 +156,6 @@ struct TestChain100Setup : public RegTestingSetup {
|
||||
CAmount output_amount = CAmount(1 * COIN),
|
||||
bool submit = true);
|
||||
|
||||
~TestChain100Setup();
|
||||
|
||||
std::vector<CTransactionRef> m_coinbase_txns; // For convenience, coinbase transactions
|
||||
CKey coinbaseKey; // private/public key needed to spend coinbase transactions
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user