Bitcoin Core  25.99.0
P2P Digital Currency
txmempool.h
Go to the documentation of this file.
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 
16 
18  // Default values
21  unsigned int nHeight{1};
22  bool spendsCoinbase{false};
23  unsigned int sigOpCost{4};
25 
27  CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
28 
29  // Change the default value
30  TestMemPoolEntryHelper& Fee(CAmount _fee) { nFee = _fee; return *this; }
31  TestMemPoolEntryHelper& Time(NodeSeconds tp) { time = tp; return *this; }
32  TestMemPoolEntryHelper& Height(unsigned int _height) { nHeight = _height; return *this; }
33  TestMemPoolEntryHelper& SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
34  TestMemPoolEntryHelper& SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; }
35 };
36 
37 #endif // BITCOIN_TEST_UTIL_TXMEMPOOL_H
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: mempool_entry.h:66
Definition: init.h:25
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:421
A mutable version of CTransaction.
Definition: transaction.h:380
Definition: txmempool.h:17
TestMemPoolEntryHelper & SpendsCoinbase(bool _flag)
Definition: txmempool.h:33
CAmount nFee
Definition: txmempool.h:19
TestMemPoolEntryHelper & SigOpsCost(unsigned int _sigopsCost)
Definition: txmempool.h:34
bool spendsCoinbase
Definition: txmempool.h:22
LockPoints lp
Definition: txmempool.h:24
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
Definition: txmempool.cpp:30
TestMemPoolEntryHelper & Height(unsigned int _height)
Definition: txmempool.h:32
unsigned int nHeight
Definition: txmempool.h:21
TestMemPoolEntryHelper & Time(NodeSeconds tp)
Definition: txmempool.h:31
unsigned int sigOpCost
Definition: txmempool.h:23
TestMemPoolEntryHelper & Fee(CAmount _fee)
Definition: txmempool.h:30
NodeSeconds time
Definition: txmempool.h:20
Options struct containing options for constructing a CTxMemPool.
NodeContext struct containing references to chain state and connection state.
Definition: context.h:45
CTxMemPool::Options MemPoolOptionsForTest(const node::NodeContext &node)
Definition: txmempool.cpp:17
std::chrono::time_point< NodeClock, std::chrono::seconds > NodeSeconds
Definition: time.h:25