aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/setup_common.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2020-08-31 12:39:39 -0400
committerJames O'Beirne <james.obeirne@pm.me>2021-02-12 07:53:36 -0600
commit31d225274ff1a4b245aea0a69f0e5224b0e64ca2 (patch)
tree6fb0cb907ac8eed73edc23ee740eaedf1027ba01 /src/test/util/setup_common.h
parent6606a4f8c616cf256537c3bfbdade9b43c51b4f5 (diff)
downloadbitcoin-31d225274ff1a4b245aea0a69f0e5224b0e64ca2.tar.xz
tests: add deterministic chain generation unittest fixture
Diffstat (limited to 'src/test/util/setup_common.h')
-rw-r--r--src/test/util/setup_common.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index 331c1235cb..4be4763f35 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -78,7 +78,6 @@ struct BasicTestingSetup {
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});
~BasicTestingSetup();
-private:
const fs::path m_path_root;
};
@@ -112,7 +111,7 @@ class CScript;
* Testing fixture that pre-creates a 100-block REGTEST-mode block chain
*/
struct TestChain100Setup : public RegTestingSetup {
- TestChain100Setup();
+ TestChain100Setup(bool deterministic = false);
/**
* Create a new block with just given transactions, coinbase paying to
@@ -121,12 +120,21 @@ struct TestChain100Setup : public RegTestingSetup {
CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
const CScript& scriptPubKey);
+ //! Mine a series of new blocks on the active chain.
+ void mineBlocks(int num_blocks);
+
~TestChain100Setup();
+ bool m_deterministic;
std::vector<CTransactionRef> m_coinbase_txns; // For convenience, coinbase transactions
CKey coinbaseKey; // private/public key needed to spend coinbase transactions
};
+
+struct TestChain100DeterministicSetup : public TestChain100Setup {
+ TestChain100DeterministicSetup() : TestChain100Setup(true) { }
+};
+
class CTxMemPoolEntry;
struct TestMemPoolEntryHelper