diff options
author | glozow <gloriajzhao@gmail.com> | 2022-04-20 14:04:11 -0700 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2022-05-30 16:00:41 -0700 |
commit | 21187506311d1703d2bca21ccc17c3a921454b70 (patch) | |
tree | f3d589b7bbb7a77f8d8d666f0d967fb8bc8ab661 /src/test/util/setup_common.h | |
parent | 5374dfc4e3da0e6a76f33b42966b4acf446233dc (diff) |
[test util] to populate mempool with random transactions/packages
Diffstat (limited to 'src/test/util/setup_common.h')
-rw-r--r-- | src/test/util/setup_common.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index dd01afe087..4270eb18c6 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -165,6 +165,19 @@ struct TestChain100Setup : public TestingSetup { CAmount output_amount = CAmount(1 * COIN), bool submit = true); + /** Create transactions spending from m_coinbase_txns. These transactions will only spend coins + * that exist in the current chain, but may be premature coinbase spends, have missing + * signatures, or violate some other consensus rules. They should only be used for testing + * mempool consistency. All transactions will have some random number of inputs and outputs + * (between 1 and 24). Transactions may or may not be dependent upon each other; if dependencies + * exit, every parent will always be somewhere in the list before the child so each transaction + * can be submitted in the same order they appear in the list. + * @param[in] submit When true, submit transactions to the mempool. + * When false, return them but don't submit them. + * @returns A vector of transactions that can be submitted to the mempool. + */ + std::vector<CTransactionRef> PopulateMempool(FastRandomContext& det_rand, size_t num_transactions, bool submit); + std::vector<CTransactionRef> m_coinbase_txns; // For convenience, coinbase transactions CKey coinbaseKey; // private/public key needed to spend coinbase transactions }; |