1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
crate::ix!();
/**
| (Try to) add a transaction to the memory
| pool.
|
| -----------
| @param[in] bypass_limits
|
| When true, don't enforce mempool fee
| limits.
| ----------
| @param[in] test_accept
|
| When true, run validation checks but
| don't submit to mempool.
|
*/
#[EXCLUSIVE_LOCKS_REQUIRED(cs_main)]
pub fn accept_to_memory_pool(
active_chainstate: &mut dyn ChainStateInterface,
pool: Amo<TxMemPool>,
tx: TransactionRef,
bypass_limits: bool,
test_accept: Option<bool>) -> MempoolAcceptResult
{
let test_accept: bool = test_accept.unwrap_or(false);
todo!();
/*
return AcceptToMemoryPoolWithTime(Params(), pool, active_chainstate, tx, GetTime(), bypass_limits, test_accept);
*/
}
/**
| (try to) add transaction to memory pool
| with a specified acceptance time *
|
*/
#[EXCLUSIVE_LOCKS_REQUIRED(cs_main)]
pub fn accept_to_memory_pool_with_time(
chainparams: &ChainParams,
pool: Amo<TxMemPool>,
active_chainstate: &mut dyn ChainStateInterface,
tx: &TransactionRef,
n_accept_time: i64,
bypass_limits: bool,
test_accept: bool) -> MempoolAcceptResult
{
todo!();
/*
std::vector<OutPoint> coins_to_uncache;
MemPoolAccept::ATMPArgs args { chainparams, nAcceptTime, bypass_limits, coins_to_uncache,
test_accept, /* m_allow_bip125_replacement */ true };
const MempoolAcceptResult result = MemPoolAccept(pool, active_chainstate).AcceptSingleTransaction(tx, args);
if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) {
// Remove coins that were not present in the coins cache before calling
// AcceptSingleTransaction(); this is to prevent memory DoS in case we receive a large
// number of invalid transactions that attempt to overrun the in-memory coins cache
// (`CCoinsViewCache::cacheCoins`).
for (const OutPoint& hashTx : coins_to_uncache)
active_chainstate.CoinsTip().Uncache(hashTx);
}
// After we've (potentially) uncached entries, ensure our coins cache is still within its size limits
BlockValidationState state_dummy;
active_chainstate.FlushStateToDisk(state_dummy, FlushStateMode::PERIODIC);
return result;
*/
}