Bitcoin Core
25.99.0
P2P Digital Currency
src
test
util
txmempool.cpp
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
#include <
test/util/txmempool.h
>
6
7
#include <chainparams.h>
8
#include <
node/context.h
>
9
#include <
node/mempool_args.h
>
10
#include <
txmempool.h
>
11
#include <
util/check.h
>
12
#include <
util/time.h
>
13
#include <
util/translation.h
>
14
15
using
node::NodeContext
;
16
17
CTxMemPool::Options
MemPoolOptionsForTest
(
const
NodeContext
&
node
)
18
{
19
CTxMemPool::Options
mempool_opts{
20
.
estimator
=
node
.fee_estimator.get(),
21
// Default to always checking mempool regardless of
22
// chainparams.DefaultConsistencyChecks for tests
23
.check_ratio = 1,
24
};
25
const
auto
result{
ApplyArgsManOptions
(*
node
.args, ::
Params
(), mempool_opts)};
26
Assert
(result);
27
return
mempool_opts;
28
}
29
30
CTxMemPoolEntry
TestMemPoolEntryHelper::FromTx
(
const
CMutableTransaction
& tx)
const
31
{
32
return
FromTx
(
MakeTransactionRef
(tx));
33
}
34
35
CTxMemPoolEntry
TestMemPoolEntryHelper::FromTx
(
const
CTransactionRef
& tx)
const
36
{
37
return
CTxMemPoolEntry
{tx,
nFee
, TicksSinceEpoch<std::chrono::seconds>(
time
),
nHeight
,
spendsCoinbase
,
sigOpCost
,
lp
};
38
}
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition:
chainparams.cpp:104
check.h
Assert
#define Assert(val)
Identity function.
Definition:
check.h:73
CTxMemPoolEntry
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition:
mempool_entry.h:66
mempool_args.h
node
Definition:
init.h:25
node::ApplyArgsManOptions
util::Result< void > ApplyArgsManOptions(const ArgsManager &args, BlockManager::Options &opts)
Definition:
blockmanager_args.cpp:17
context.h
MakeTransactionRef
static CTransactionRef MakeTransactionRef(Tx &&txIn)
Definition:
transaction.h:422
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition:
transaction.h:421
CMutableTransaction
A mutable version of CTransaction.
Definition:
transaction.h:380
TestMemPoolEntryHelper::nFee
CAmount nFee
Definition:
txmempool.h:19
TestMemPoolEntryHelper::spendsCoinbase
bool spendsCoinbase
Definition:
txmempool.h:22
TestMemPoolEntryHelper::lp
LockPoints lp
Definition:
txmempool.h:24
TestMemPoolEntryHelper::FromTx
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
Definition:
txmempool.cpp:30
TestMemPoolEntryHelper::nHeight
unsigned int nHeight
Definition:
txmempool.h:21
TestMemPoolEntryHelper::sigOpCost
unsigned int sigOpCost
Definition:
txmempool.h:23
TestMemPoolEntryHelper::time
NodeSeconds time
Definition:
txmempool.h:20
kernel::MemPoolOptions
Options struct containing options for constructing a CTxMemPool.
Definition:
mempool_options.h:36
kernel::MemPoolOptions::estimator
CBlockPolicyEstimator * estimator
Definition:
mempool_options.h:38
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition:
context.h:45
MemPoolOptionsForTest
CTxMemPool::Options MemPoolOptionsForTest(const NodeContext &node)
Definition:
txmempool.cpp:17
txmempool.h
time.h
translation.h
txmempool.h
Generated on Fri Jun 2 2023 02:43:52 for Bitcoin Core by
1.9.1