LCOV - code coverage report
Current view: top level - src/test/util - txmempool.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 11 11 100.0 %
Date: 2026-06-25 07:23:43 Functions: 7 7 100.0 %

          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             : // TODO: belongs to bitcoin/bitcoin#25290; uncomment when done
      12             : // CTxMemPool::Options MemPoolOptionsForTest(const node::NodeContext& node);
      13             : 
      14          17 : struct TestMemPoolEntryHelper {
      15             :     // Default values
      16          17 :     CAmount nFee{0};
      17          17 :     NodeSeconds time{};
      18          17 :     unsigned int nHeight{1};
      19          17 :     bool spendsCoinbase{false};
      20          17 :     unsigned int sigOpCount{1};
      21             :     LockPoints lp;
      22             : 
      23             :     CTxMemPoolEntry FromTx(const CMutableTransaction& tx) const;
      24             :     CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
      25             : 
      26             :     // Change the default value
      27       26798 :     TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
      28       26752 :     TestMemPoolEntryHelper& Time(NodeSeconds tp) { time = tp; return *this; }
      29       24600 :     TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
      30        2150 :     TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
      31        1001 :     TestMemPoolEntryHelper& SigOps(unsigned int _sigops) { sigOpCount = _sigops; return *this; }
      32             : };
      33             : 
      34             : #endif // BITCOIN_TEST_UTIL_TXMEMPOOL_H

Generated by: LCOV version 1.16