Skip to content

Commit 98fdacf

Browse files
authored
Merge pull request #87 from frstrtr/ltc-doge/85-densepplns-window-rename
rename DensePPLNSRing -> DensePPLNSWindow (ltc + btc), SAFE-COSMETIC
2 parents f532429 + 52491e9 commit 98fdacf

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/impl/btc/node.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
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)
2121
static long get_rss_mb() {

src/impl/btc/share_tracker.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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 {
149149
public:
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

254254
class 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 ---

src/impl/ltc/node.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
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)
2121
static long get_rss_mb() {

src/impl/ltc/share_tracker.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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 {
149149
public:
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

254254
class 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 ---

0 commit comments

Comments
 (0)