Line data Source code
1 : // Copyright (c) 2022 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #ifndef BITCOIN_TEST_UTIL_TXMEMPOOL_H 6 : #define BITCOIN_TEST_UTIL_TXMEMPOOL_H 7 : 8 : #include <txmempool.h> 9 : #include <util/time.h> 10 : 11 : namespace node { 12 : struct NodeContext; 13 : } 14 : 15 : CTxMemPool::Options MemPoolOptionsForTest(const node::NodeContext& node); 16 : 17 0 : struct TestMemPoolEntryHelper { 18 : // Default values 19 0 : CAmount nFee{0}; 20 0 : NodeSeconds time{}; 21 0 : unsigned int nHeight{1}; 22 0 : uint64_t m_sequence{0}; 23 0 : bool spendsCoinbase{false}; 24 0 : unsigned int sigOpCost{4}; 25 : LockPoints lp; 26 : 27 : CTxMemPoolEntry FromTx(const CMutableTransaction& tx) const; 28 : CTxMemPoolEntry FromTx(const CTransactionRef& tx) const; 29 : 30 : // Change the default value 31 0 : TestMemPoolEntryHelper& Fee(CAmount _fee) { nFee = _fee; return *this; } 32 : TestMemPoolEntryHelper& Time(NodeSeconds tp) { time = tp; return *this; } 33 : TestMemPoolEntryHelper& Height(unsigned int _height) { nHeight = _height; return *this; } 34 : TestMemPoolEntryHelper& Sequence(uint64_t _seq) { m_sequence = _seq; return *this; } 35 : TestMemPoolEntryHelper& SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; } 36 : TestMemPoolEntryHelper& SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; } 37 : }; 38 : 39 : #endif // BITCOIN_TEST_UTIL_TXMEMPOOL_H