aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-07-07 16:32:52 -0400
committerCarl Dong <contact@carldong.me>2022-07-15 11:35:13 -0400
commit813962da0b17b918941c6849996845e35d84a451 (patch)
tree0aeefc022c8f8b819604f1241bf15fdd1990c628 /src
parent413f4bb52b72e082ad8716664ede48352b8e7e5a (diff)
downloadbitcoin-813962da0b17b918941c6849996845e35d84a451.tar.xz
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-
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp2
-rw-r--r--src/rpc/mempool.cpp4
-rw-r--r--src/txmempool.cpp8
-rw-r--r--src/txmempool.h6
-rw-r--r--src/validation.cpp2
5 files changed, 11 insertions, 11 deletions
diff --git a/src/init.cpp b/src/init.cpp
index fc068cf25e..62eff218cb 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -249,7 +249,7 @@ void Shutdown(NodeContext& node)
node.addrman.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));
}
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index bab358d50a..7f4ff47941 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -656,7 +656,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
// Make sure this call is atomic in the pool.
LOCK(pool.cs);
UniValue ret(UniValue::VOBJ);
- ret.pushKV("loaded", pool.IsLoaded());
+ ret.pushKV("loaded", pool.GetLoadTried());
ret.pushKV("size", (int64_t)pool.size());
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
ret.pushKV("usage", (int64_t)pool.DynamicMemoryUsage());
@@ -720,7 +720,7 @@ static RPCHelpMan savemempool()
const ArgsManager& args{EnsureAnyArgsman(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");
}
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index aeaa10034e..00e3068946 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -1210,14 +1210,14 @@ void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors,
}
}
-bool CTxMemPool::IsLoaded() const
+bool CTxMemPool::GetLoadTried() const
{
LOCK(cs);
- return m_is_loaded;
+ return m_load_tried;
}
-void CTxMemPool::SetIsLoaded(bool loaded)
+void CTxMemPool::SetLoadTried(bool loaded)
{
LOCK(cs);
- m_is_loaded = loaded;
+ m_load_tried = loaded;
}
diff --git a/src/txmempool.h b/src/txmempool.h
index 6e37f59f2e..1abf641ed2 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -451,7 +451,7 @@ protected:
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;
@@ -729,10 +729,10 @@ public:
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 */
- bool IsLoaded() const;
+ bool GetLoadTried() const;
/** Sets the current loaded state */
- void SetIsLoaded(bool loaded);
+ void SetLoadTried(bool loaded);
unsigned long size() const
{
diff --git a/src/validation.cpp b/src/validation.cpp
index 4d02fbef53..5c7bfc510c 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3869,7 +3869,7 @@ void CChainState::LoadMempool(const ArgsManager& args)
if (args.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
::LoadMempool(*m_mempool, *this);
}
- m_mempool->SetIsLoaded(!ShutdownRequested());
+ m_mempool->SetLoadTried(!ShutdownRequested());
}
bool CChainState::LoadChainTip()