| 284 | namespace { |
| 285 | |
| 286 | class MemPoolAccept { |
| 287 | public: |
| 288 | MemPoolAccept(CTxMemPool &mempool, Chainstate &active_chainstate) |
| 289 | : m_pool(mempool), m_view(&m_dummy), |
| 290 | m_viewmempool(&active_chainstate.CoinsTip(), m_pool), |
| 291 | m_active_chainstate(active_chainstate) {} |
| 292 | |
| 293 | // We put the arguments we're handed into a struct, so we can pass them |
| 294 | // around easier. |
| 295 | struct ATMPArgs { |
| 296 | const Config &m_config; |
| 297 | const int64_t m_accept_time; |
| 298 | const bool m_bypass_limits; |
| 299 | /* |
| 300 | * Return any outpoints which were not previously present in the coins |
| 301 | * cache, but were added as a result of validating the tx for mempool |
| 302 | * acceptance. This allows the caller to optionally remove the cache |
| 303 | * additions if the associated transaction ends up being rejected by |
| 304 | * the mempool. |
| 305 | */ |
| 306 | std::vector<COutPoint> &m_coins_to_uncache; |
| 307 | const bool m_test_accept; |
| 308 | const unsigned int m_heightOverride; |
| 309 | /** |
| 310 | * When true, the mempool will not be trimmed when any transactions are |
| 311 | * submitted in Finalize(). Instead, limits should be enforced at the |
| 312 | * end to ensure the package is not partially submitted. |
| 313 | */ |
| 314 | const bool m_package_submission; |
| 315 | /** |
| 316 | * When true, use package feerates instead of individual transaction |
| 317 | * feerates for fee-based policies such as mempool min fee and min relay |
| 318 | * fee. |
| 319 | */ |
| 320 | const bool m_package_feerates; |
| 321 | |
| 322 | /** Parameters for single transaction mempool validation. */ |
| 323 | static ATMPArgs SingleAccept(const Config &config, int64_t accept_time, |
| 324 | bool bypass_limits, |
| 325 | std::vector<COutPoint> &coins_to_uncache, |
| 326 | bool test_accept, |
| 327 | unsigned int heightOverride) { |
| 328 | return ATMPArgs{ |
| 329 | config, |
| 330 | accept_time, |
| 331 | bypass_limits, |
| 332 | coins_to_uncache, |
| 333 | test_accept, |
| 334 | heightOverride, |
| 335 | /*package_submission=*/false, |
| 336 | /*package_feerates=*/false, |
| 337 | }; |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Parameters for test package mempool validation through |
| 342 | * testmempoolaccept. |
| 343 | */ |
no outgoing calls
no test coverage detected