mempool_persist.h raw

   1  // Copyright (c) 2022-present 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_NODE_MEMPOOL_PERSIST_H
   6  #define BITCOIN_NODE_MEMPOOL_PERSIST_H
   7  
   8  #include <util/fs.h>
   9  
  10  class Chainstate;
  11  class CTxMemPool;
  12  
  13  namespace node {
  14  
  15  /** Dump the mempool to a file. */
  16  bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path,
  17                   fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen,
  18                   bool skip_file_commit = false);
  19  
  20  struct ImportMempoolOptions {
  21      fsbridge::FopenFn mockable_fopen_function{fsbridge::fopen};
  22      bool use_current_time{false};
  23      bool apply_fee_delta_priority{true};
  24      bool apply_unbroadcast_set{true};
  25  };
  26  /** Import the file and attempt to add its contents to the mempool. */
  27  bool LoadMempool(CTxMemPool& pool, const fs::path& load_path,
  28                   Chainstate& active_chainstate,
  29                   ImportMempoolOptions&& opts);
  30  
  31  } // namespace node
  32  
  33  
  34  #endif // BITCOIN_NODE_MEMPOOL_PERSIST_H
  35