Skip to content

Commit e321717

Browse files
committed
Add periodic PPLNS weight dump for cross-implementation comparison
Identified: c2pool's generate_share_transaction includes 3 addresses (including c2pool miner) while p2pool has only 2. C2pool's chain tip alternates between own shares and p2pool shares. When verifying a share whose prev_hash is a c2pool share, the PPLNS walk includes c2pool's miner address — but p2pool never has these shares in its chain. Fix: generate_share_transaction should exclude c2pool's own unverified shares from the PPLNS walk, OR c2pool should not add own shares to the tracker until they're accepted by peers. Also reverted p2pool bootstrap 'hardest bits' which broke share rate.
1 parent daf58a1 commit e321717

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/impl/ltc/share_check.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,26 @@ uint256 generate_share_transaction(const ShareT& share, TrackerT& tracker, bool
875875

876876
std::map<std::vector<unsigned char>, uint64_t> amounts;
877877

878+
// Periodic dump of PPLNS weights for cross-impl comparison
879+
{
880+
static auto last_amt_dump = std::chrono::steady_clock::now() - std::chrono::seconds(60);
881+
auto now_d = std::chrono::steady_clock::now();
882+
if (now_d - last_amt_dump > std::chrono::seconds(30) && weights.size() >= 2) {
883+
last_amt_dump = now_d;
884+
LOG_INFO << "[PPLNS-AMT] subsidy=" << subsidy
885+
<< " total_weight=" << total_weight.GetLow64()
886+
<< " don_weight=" << total_donation_weight.GetLow64()
887+
<< " addrs=" << weights.size()
888+
<< " prev=" << prev_hash.GetHex().substr(0, 16);
889+
for (auto& [s, w] : weights) {
890+
uint64_t a = (total_weight.IsNull()) ? 0 :
891+
(uint288(subsidy) * w / total_weight).GetLow64();
892+
LOG_INFO << "[PPLNS-AMT] weight=" << w.GetLow64()
893+
<< " amount=" << a;
894+
}
895+
}
896+
}
897+
878898
if (!total_weight.IsNull())
879899
{
880900
for (auto& [script, weight] : weights)

0 commit comments

Comments
 (0)