Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/impl/dgb/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,16 @@ void NodeImpl::run_think()
m_whale_departure.detect(m_tracker, m_best_share_hash),
std::memory_order_relaxed);

// Phase 3L: log-based pool monitor on a ~30s cadence (same exclusive
// tracker lock). Consensus-neutral — emits [MONITOR-*] lines only.
{
auto mon_now = static_cast<uint32_t>(std::time(nullptr));
if (mon_now - m_last_monitor_ts >= MONITOR_INTERVAL_S) {
m_last_monitor_ts = mon_now;
m_pool_monitor.run_cycle(m_tracker, m_best_share_hash);
}
}

// Publish lock-free snapshot for all IO-thread consumers
publish_snapshot();

Expand Down
7 changes: 7 additions & 0 deletions src/impl/dgb/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "share.hpp"
#include "share_tracker.hpp"
#include "whale_departure.hpp"
#include "pool_monitor.hpp"
#include "peer.hpp"
#include "messages.hpp"

Expand Down Expand Up @@ -62,6 +63,12 @@ class NodeImpl : public pool::BaseNode<dgb::Config, dgb::ShareChain, dgb::Peer>
WhaleDepartureDetector m_whale_departure;
// Lock-free publication of the detector verdict (see local_desired_target).
std::atomic<bool> m_whale_departure_active{false};
// Phase 3L non-consensus log-based pool monitor (attack/anomaly detection).
// Driven from run_think() under the exclusive tracker lock on a ~30s cadence;
// emits [MONITOR-*] log lines only — no consensus / sharechain effect.
PoolMonitor m_pool_monitor;
uint32_t m_last_monitor_ts{0};
static constexpr uint32_t MONITOR_INTERVAL_S = 30;
std::unique_ptr<c2pool::storage::SharechainStorage> m_storage;

// Global pool of known transactions, populated by remember_tx and coin daemon.
Expand Down
Loading