diff options
Diffstat (limited to 'src/test/util/setup_common.h')
-rw-r--r-- | src/test/util/setup_common.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 7cd4fdb417..4e1a26f303 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -124,7 +124,44 @@ struct TestChain100Setup : public TestingSetup { void mineBlocks(int num_blocks); /** - * Create a transaction and submit to the mempool. + * Create a transaction, optionally setting the fee based on the feerate. + * Note: The feerate may not be met exactly depending on whether the signatures can have different sizes. + * + * @param input_transactions The transactions to spend + * @param inputs Outpoints with which to construct transaction vin. + * @param input_height The height of the block that included the input transactions. + * @param input_signing_keys The keys to spend the input transactions. + * @param outputs Transaction vout. + * @param feerate The feerate the transaction should pay. + * @param fee_output The index of the output to take the fee from. + * @return The transaction and the fee it pays + */ + std::pair<CMutableTransaction, CAmount> CreateValidTransaction(const std::vector<CTransactionRef>& input_transactions, + const std::vector<COutPoint>& inputs, + int input_height, + const std::vector<CKey>& input_signing_keys, + const std::vector<CTxOut>& outputs, + const std::optional<CFeeRate>& feerate, + const std::optional<uint32_t>& fee_output); + /** + * Create a transaction and, optionally, submit to the mempool. + * + * @param input_transactions The transactions to spend + * @param inputs Outpoints with which to construct transaction vin. + * @param input_height The height of the block that included the input transaction(s). + * @param input_signing_keys The keys to spend inputs. + * @param outputs Transaction vout. + * @param submit Whether or not to submit to mempool + */ + CMutableTransaction CreateValidMempoolTransaction(const std::vector<CTransactionRef>& input_transactions, + const std::vector<COutPoint>& inputs, + int input_height, + const std::vector<CKey>& input_signing_keys, + const std::vector<CTxOut>& outputs, + bool submit = true); + + /** + * Create a 1-in-1-out transaction and, optionally, submit to the mempool. * * @param input_transaction The transaction to spend * @param input_vout The vout to spend from the input_transaction @@ -135,7 +172,7 @@ struct TestChain100Setup : public TestingSetup { * @param submit Whether or not to submit to mempool */ CMutableTransaction CreateValidMempoolTransaction(CTransactionRef input_transaction, - int input_vout, + uint32_t input_vout, int input_height, CKey input_signing_key, CScript output_destination, |