aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/setup_common.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2021-04-08 10:06:10 -0400
committerJames O'Beirne <james.obeirne@pm.me>2021-09-15 15:46:50 -0400
commit2705570109a2a90ecfd3f4180944498626fc2707 (patch)
tree71c89732897c6ba16873d5401d4c6afac6518bcb /src/test/util/setup_common.h
parent298bf5d563cc740c6ae71750d86942e0278b22d6 (diff)
test: refactor: separate CreateBlock in TestChain100Setup
This is so we can create blocks within unittests and have them be processed by specific chainstates (instead of the just the active one).
Diffstat (limited to 'src/test/util/setup_common.h')
-rw-r--r--src/test/util/setup_common.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index 5d12dc2323..acb96e54df 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -119,9 +119,20 @@ struct TestChain100Setup : public RegTestingSetup {
/**
* Create a new block with just given transactions, coinbase paying to
* scriptPubKey, and try to add it to the current chain.
+ * If no chainstate is specified, default to the active.
*/
CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
- const CScript& scriptPubKey);
+ const CScript& scriptPubKey,
+ CChainState* chainstate = nullptr);
+
+ /**
+ * Create a new block with just given transactions, coinbase paying to
+ * scriptPubKey.
+ */
+ CBlock CreateBlock(
+ const std::vector<CMutableTransaction>& txns,
+ const CScript& scriptPubKey,
+ CChainState& chainstate);
//! Mine a series of new blocks on the active chain.
void mineBlocks(int num_blocks);