aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcofleon <marleo23@proton.me>2024-05-28 09:45:19 -0700
committermarcofleon <marleo23@proton.me>2024-05-29 08:22:11 -0700
commit0048680467e15037023ceae44bc2dc8309f82f39 (patch)
treee5f24cf5694cbdb6ce52e499a8050e136288e503
parent10164916f712bd3c92f0b3ac329ba2e1209746fe (diff)
downloadbitcoin-0048680467e15037023ceae44bc2dc8309f82f39.tar.xz
increase txorphan harness stability
initialize variable
-rw-r--r--src/txorphanage.cpp1
-rw-r--r--src/txorphanage.h3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index 8e76c07b07..cfafadcb98 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -119,7 +119,6 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans, FastRandomContext& rng)
LOCK(m_mutex);
unsigned int nEvicted = 0;
- static NodeSeconds nNextSweep;
auto nNow{Now<NodeSeconds>()};
if (nNextSweep <= nNow) {
// Sweep out expired orphan pool entries:
diff --git a/src/txorphanage.h b/src/txorphanage.h
index 47becb447d..2da8582869 100644
--- a/src/txorphanage.h
+++ b/src/txorphanage.h
@@ -105,6 +105,9 @@ protected:
/** Erase an orphan by wtxid */
int EraseTxNoLock(const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
+
+ /** Timestamp for the next scheduled sweep of expired orphans */
+ NodeSeconds nNextSweep GUARDED_BY(m_mutex){0s};
};
#endif // BITCOIN_TXORPHANAGE_H