scripted-diff: Rename m_is_loaded -> m_load_tried

m_is_loaded/IsLoaded() doesn't actually indicate whether or not the
mempool was successfully, loaded, but rather if a load has been
attempted and did not result in a catastrophic ShutdownRequested.

-BEGIN VERIFY SCRIPT-
find_regex="\bm_is_loaded\b" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@m_load_tried@g"

find_regex="\bIsLoaded\b" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@GetLoadTried@g"

find_regex="\bSetIsLoaded\b" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@SetLoadTried@g"
-END VERIFY SCRIPT-
This commit is contained in:
Carl Dong 2022-07-07 16:32:52 -04:00
parent 413f4bb52b
commit 813962da0b
5 changed files with 11 additions and 11 deletions

View File

@ -249,7 +249,7 @@ void Shutdown(NodeContext& node)
node.addrman.reset(); node.addrman.reset();
node.netgroupman.reset(); node.netgroupman.reset();
if (node.mempool && node.mempool->IsLoaded() && ShouldPersistMempool(*node.args)) { if (node.mempool && node.mempool->GetLoadTried() && ShouldPersistMempool(*node.args)) {
DumpMempool(*node.mempool, MempoolPath(*node.args)); DumpMempool(*node.mempool, MempoolPath(*node.args));
} }

View File

@ -656,7 +656,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
// Make sure this call is atomic in the pool. // Make sure this call is atomic in the pool.
LOCK(pool.cs); LOCK(pool.cs);
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
ret.pushKV("loaded", pool.IsLoaded()); ret.pushKV("loaded", pool.GetLoadTried());
ret.pushKV("size", (int64_t)pool.size()); ret.pushKV("size", (int64_t)pool.size());
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize()); ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
ret.pushKV("usage", (int64_t)pool.DynamicMemoryUsage()); ret.pushKV("usage", (int64_t)pool.DynamicMemoryUsage());
@ -720,7 +720,7 @@ static RPCHelpMan savemempool()
const ArgsManager& args{EnsureAnyArgsman(request.context)}; const ArgsManager& args{EnsureAnyArgsman(request.context)};
const CTxMemPool& mempool = EnsureAnyMemPool(request.context); const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
if (!mempool.IsLoaded()) { if (!mempool.GetLoadTried()) {
throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet"); throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet");
} }

View File

@ -1210,14 +1210,14 @@ void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors,
} }
} }
bool CTxMemPool::IsLoaded() const bool CTxMemPool::GetLoadTried() const
{ {
LOCK(cs); LOCK(cs);
return m_is_loaded; return m_load_tried;
} }
void CTxMemPool::SetIsLoaded(bool loaded) void CTxMemPool::SetLoadTried(bool loaded)
{ {
LOCK(cs); LOCK(cs);
m_is_loaded = loaded; m_load_tried = loaded;
} }

View File

@ -451,7 +451,7 @@ protected:
void trackPackageRemoved(const CFeeRate& rate) EXCLUSIVE_LOCKS_REQUIRED(cs); void trackPackageRemoved(const CFeeRate& rate) EXCLUSIVE_LOCKS_REQUIRED(cs);
bool m_is_loaded GUARDED_BY(cs){false}; bool m_load_tried GUARDED_BY(cs){false};
CFeeRate GetMinFee(size_t sizelimit) const; CFeeRate GetMinFee(size_t sizelimit) const;
@ -729,10 +729,10 @@ public:
void GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* ancestorsize = nullptr, CAmount* ancestorfees = nullptr) const; void GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* ancestorsize = nullptr, CAmount* ancestorfees = nullptr) const;
/** @returns true if the mempool is fully loaded */ /** @returns true if the mempool is fully loaded */
bool IsLoaded() const; bool GetLoadTried() const;
/** Sets the current loaded state */ /** Sets the current loaded state */
void SetIsLoaded(bool loaded); void SetLoadTried(bool loaded);
unsigned long size() const unsigned long size() const
{ {

View File

@ -3869,7 +3869,7 @@ void CChainState::LoadMempool(const ArgsManager& args)
if (args.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { if (args.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
::LoadMempool(*m_mempool, *this); ::LoadMempool(*m_mempool, *this);
} }
m_mempool->SetIsLoaded(!ShutdownRequested()); m_mempool->SetLoadTried(!ShutdownRequested());
} }
bool CChainState::LoadChainTip() bool CChainState::LoadChainTip()