Skip to content

Commit 813962d

Browse files
committed
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-
1 parent 413f4bb commit 813962d

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void Shutdown(NodeContext& node)
249249
node.addrman.reset();
250250
node.netgroupman.reset();
251251

252-
if (node.mempool && node.mempool->IsLoaded() && ShouldPersistMempool(*node.args)) {
252+
if (node.mempool && node.mempool->GetLoadTried() && ShouldPersistMempool(*node.args)) {
253253
DumpMempool(*node.mempool, MempoolPath(*node.args));
254254
}
255255

src/rpc/mempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
656656
// Make sure this call is atomic in the pool.
657657
LOCK(pool.cs);
658658
UniValue ret(UniValue::VOBJ);
659-
ret.pushKV("loaded", pool.IsLoaded());
659+
ret.pushKV("loaded", pool.GetLoadTried());
660660
ret.pushKV("size", (int64_t)pool.size());
661661
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
662662
ret.pushKV("usage", (int64_t)pool.DynamicMemoryUsage());
@@ -720,7 +720,7 @@ static RPCHelpMan savemempool()
720720
const ArgsManager& args{EnsureAnyArgsman(request.context)};
721721
const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
722722

723-
if (!mempool.IsLoaded()) {
723+
if (!mempool.GetLoadTried()) {
724724
throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet");
725725
}
726726

src/txmempool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,14 +1210,14 @@ void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors,
12101210
}
12111211
}
12121212

1213-
bool CTxMemPool::IsLoaded() const
1213+
bool CTxMemPool::GetLoadTried() const
12141214
{
12151215
LOCK(cs);
1216-
return m_is_loaded;
1216+
return m_load_tried;
12171217
}
12181218

1219-
void CTxMemPool::SetIsLoaded(bool loaded)
1219+
void CTxMemPool::SetLoadTried(bool loaded)
12201220
{
12211221
LOCK(cs);
1222-
m_is_loaded = loaded;
1222+
m_load_tried = loaded;
12231223
}

src/txmempool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class CTxMemPool
451451

452452
void trackPackageRemoved(const CFeeRate& rate) EXCLUSIVE_LOCKS_REQUIRED(cs);
453453

454-
bool m_is_loaded GUARDED_BY(cs){false};
454+
bool m_load_tried GUARDED_BY(cs){false};
455455

456456
CFeeRate GetMinFee(size_t sizelimit) const;
457457

@@ -729,10 +729,10 @@ class CTxMemPool
729729
void GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* ancestorsize = nullptr, CAmount* ancestorfees = nullptr) const;
730730

731731
/** @returns true if the mempool is fully loaded */
732-
bool IsLoaded() const;
732+
bool GetLoadTried() const;
733733

734734
/** Sets the current loaded state */
735-
void SetIsLoaded(bool loaded);
735+
void SetLoadTried(bool loaded);
736736

737737
unsigned long size() const
738738
{

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,7 @@ void CChainState::LoadMempool(const ArgsManager& args)
38693869
if (args.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
38703870
::LoadMempool(*m_mempool, *this);
38713871
}
3872-
m_mempool->SetIsLoaded(!ShutdownRequested());
3872+
m_mempool->SetLoadTried(!ShutdownRequested());
38733873
}
38743874

38753875
bool CChainState::LoadChainTip()

0 commit comments

Comments
 (0)