Skip to content

Commit

Permalink
doc: Rename kernel::LoadMempool to kernel::ImportMempool
Browse files Browse the repository at this point in the history
This clarifies the difference to Chainstate::LoadMempool.

Also, clarify the getmempoolinfo.loaded RPC field documentation.
  • Loading branch information
MarcoFalke committed Apr 20, 2023
1 parent 3133d93 commit fa4616a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/kernel/mempool_persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <util/time.h>
#include <validation.h>

#include <chrono>
#include <cstdint>
#include <cstdio>
#include <exception>
Expand All @@ -37,7 +36,7 @@ namespace kernel {

static const uint64_t MEMPOOL_DUMP_VERSION = 1;

bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active_chainstate, FopenFn mockable_fopen_function)
bool ImportMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active_chainstate, FopenFn mockable_fopen_function)
{
if (load_path.empty()) return false;

Expand Down
6 changes: 3 additions & 3 deletions src/kernel/mempool_persist.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class CTxMemPool;

namespace kernel {

/** Dump the mempool to disk. */
/** Dump the mempool to a file. */
bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path,
fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen,
bool skip_file_commit = false);

/** Load the mempool from disk. */
bool LoadMempool(CTxMemPool& pool, const fs::path& load_path,
/** Import the file and attempt to add its contents to the mempool. */
bool ImportMempool(CTxMemPool& pool, const fs::path& load_path,
Chainstate& active_chainstate,
fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen);

Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ static RPCHelpMan getmempoolinfo()
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::BOOL, "loaded", "True if the mempool is fully loaded"},
{RPCResult::Type::BOOL, "loaded", "True if the initial load attempt of the persisted mempool finished"},
{RPCResult::Type::NUM, "size", "Current tx count"},
{RPCResult::Type::NUM, "bytes", "Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted"},
{RPCResult::Type::NUM, "usage", "Total memory usage for the mempool"},
Expand Down
4 changes: 2 additions & 2 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,13 @@ class CTxMemPool
void GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* ancestorsize = nullptr, CAmount* ancestorfees = nullptr) const;

/**
* @returns true if we've made an attempt to load the mempool regardless of
* @returns true if an initial attempt to load the persisted mempool was made, regardless of
* whether the attempt was successful or not
*/
bool GetLoadTried() const;

/**
* Set whether or not we've made an attempt to load the mempool (regardless
* Set whether or not an initial attempt to load the persisted mempool was made (regardless
* of whether the attempt was successful or not)
*/
void SetLoadTried(bool load_tried);
Expand Down
4 changes: 2 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
using kernel::CCoinsStats;
using kernel::CoinStatsHashType;
using kernel::ComputeUTXOStats;
using kernel::LoadMempool;
using kernel::ImportMempool;

using fsbridge::FopenFn;
using node::BlockManager;
Expand Down Expand Up @@ -4105,7 +4105,7 @@ void PruneBlockFilesManual(Chainstate& active_chainstate, int nManualPruneHeight
void Chainstate::LoadMempool(const fs::path& load_path, FopenFn mockable_fopen_function)
{
if (!m_mempool) return;
::LoadMempool(*m_mempool, load_path, *this, mockable_fopen_function);
::ImportMempool(*m_mempool, load_path, *this, mockable_fopen_function);
m_mempool->SetLoadTried(!ShutdownRequested());
}

Expand Down
2 changes: 1 addition & 1 deletion src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ class Chainstate
*/
void CheckBlockIndex();

/** Load the persisted mempool from disk */
/** Attempt to load the persisted mempool from a file on startup and set the mempool "loaded" field when done. */
void LoadMempool(const fs::path& load_path, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen);

/** Update the chain tip based on database information, i.e. CoinsTip()'s best block. */
Expand Down

0 comments on commit fa4616a

Please sign in to comment.