File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include < iomanip>
1313#include < random>
1414
15- // Static members for DensePPLNSRing precomputed decay table
16- std::vector<uint64_t > btc::DensePPLNSRing ::s_decay_table;
17- uint64_t btc::DensePPLNSRing ::s_decay_per = 0 ;
18- bool btc::DensePPLNSRing ::s_table_initialized = false ;
15+ // Static members for DensePPLNSWindow precomputed decay table
16+ std::vector<uint64_t > btc::DensePPLNSWindow ::s_decay_table;
17+ uint64_t btc::DensePPLNSWindow ::s_decay_per = 0 ;
18+ bool btc::DensePPLNSWindow ::s_table_initialized = false ;
1919
2020// Helper: read current RSS from /proc/self/status (Linux only)
2121static long get_rss_mb () {
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ struct PPLNSEntry {
145145 std::vector<unsigned char > script; // payout script (variable-length)
146146};
147147
148- class DensePPLNSRing {
148+ class DensePPLNSWindow {
149149public:
150150 static constexpr uint64_t DECAY_PRECISION = 40 ;
151151 static constexpr uint64_t DECAY_SCALE = uint64_t (1 ) << DECAY_PRECISION ;
@@ -244,15 +244,15 @@ class DensePPLNSRing {
244244};
245245
246246// ── Head-Level Incremental PPLNS ─────────────────────────────────────────
247- // Maintains a DensePPLNSRing + cached CumulativeWeights per active head.
247+ // Maintains a DensePPLNSWindow + cached CumulativeWeights per active head.
248248// When verifying consecutive shares along a chain:
249249// 1. rebuild() at first share's parent: O(chain_len) — one hash map walk
250250// 2. extend() for each subsequent share: O(1) ring push + O(chain_len) dense recompute
251251// Total for N shares: O(chain_len + N × chain_len) sequential ops
252252// vs current: O(N × chain_len) random hash map ops — ~10x faster per op.
253253
254254class HeadPPLNS {
255- DensePPLNSRing m_ring;
255+ DensePPLNSWindow m_ring;
256256 CumulativeWeights m_cached;
257257 bool m_dirty{true };
258258
@@ -306,7 +306,7 @@ class HeadPPLNS {
306306
307307 bool valid () const { return !m_ring.empty (); }
308308 int32_t window_size () const { return m_ring.size (); }
309- const DensePPLNSRing & ring () const { return m_ring; }
309+ const DensePPLNSWindow & ring () const { return m_ring; }
310310};
311311
312312// --- ShareTracker ---
Original file line number Diff line number Diff line change 1212#include < iomanip>
1313#include < random>
1414
15- // Static members for DensePPLNSRing precomputed decay table
16- std::vector<uint64_t > ltc::DensePPLNSRing ::s_decay_table;
17- uint64_t ltc::DensePPLNSRing ::s_decay_per = 0 ;
18- bool ltc::DensePPLNSRing ::s_table_initialized = false ;
15+ // Static members for DensePPLNSWindow precomputed decay table
16+ std::vector<uint64_t > ltc::DensePPLNSWindow ::s_decay_table;
17+ uint64_t ltc::DensePPLNSWindow ::s_decay_per = 0 ;
18+ bool ltc::DensePPLNSWindow ::s_table_initialized = false ;
1919
2020// Helper: read current RSS from /proc/self/status (Linux only)
2121static long get_rss_mb () {
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ struct PPLNSEntry {
145145 std::vector<unsigned char > script; // payout script (variable-length)
146146};
147147
148- class DensePPLNSRing {
148+ class DensePPLNSWindow {
149149public:
150150 static constexpr uint64_t DECAY_PRECISION = 40 ;
151151 static constexpr uint64_t DECAY_SCALE = uint64_t (1 ) << DECAY_PRECISION ;
@@ -244,15 +244,15 @@ class DensePPLNSRing {
244244};
245245
246246// ── Head-Level Incremental PPLNS ─────────────────────────────────────────
247- // Maintains a DensePPLNSRing + cached CumulativeWeights per active head.
247+ // Maintains a DensePPLNSWindow + cached CumulativeWeights per active head.
248248// When verifying consecutive shares along a chain:
249249// 1. rebuild() at first share's parent: O(chain_len) — one hash map walk
250250// 2. extend() for each subsequent share: O(1) ring push + O(chain_len) dense recompute
251251// Total for N shares: O(chain_len + N × chain_len) sequential ops
252252// vs current: O(N × chain_len) random hash map ops — ~10x faster per op.
253253
254254class HeadPPLNS {
255- DensePPLNSRing m_ring;
255+ DensePPLNSWindow m_ring;
256256 CumulativeWeights m_cached;
257257 bool m_dirty{true };
258258
@@ -306,7 +306,7 @@ class HeadPPLNS {
306306
307307 bool valid () const { return !m_ring.empty (); }
308308 int32_t window_size () const { return m_ring.size (); }
309- const DensePPLNSRing & ring () const { return m_ring; }
309+ const DensePPLNSWindow & ring () const { return m_ring; }
310310};
311311
312312// --- ShareTracker ---
You can’t perform that action at this time.
0 commit comments