Skip to content

Commit eda5112

Browse files
committed
Fix bootstrap share target: use min_work (matching p2pool), add diagnostics
Root cause found: get_pool_attempts_per_second correctly uses min_work=true (same as p2pool) to compute conservative hashrate from max_bits. The resulting share_bits matches p2pool's max_bits within ±10% clamp. Remaining blocker: generate_share_transaction produces different coinbase bytes than p2pool's generate_transaction — GENTX hash_link mismatch. This is a coinbase encoding issue, not PPLNS weights.
1 parent 6a2a475 commit eda5112

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/impl/ltc/node.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,17 @@ void NodeImpl::processing_shares_phase2(HandleSharesData& data, NetService addr)
306306
LOG_INFO << "Received share: hash=" << obj->m_hash.GetHex().substr(0, 16)
307307
<< " height=" << obj->m_absheight
308308
<< " from " << source;
309+
// One-time diagnostic: log first share's bits and chain work
310+
static int bits_log = 0;
311+
if (bits_log++ < 3) {
312+
LOG_INFO << "[SHARE-BITS] bits=0x" << std::hex << obj->m_bits
313+
<< " max_bits=0x" << obj->m_max_bits << std::dec
314+
<< " absheight=" << obj->m_absheight;
315+
auto target = chain::bits_to_target(obj->m_bits);
316+
auto att = chain::target_to_average_attempts(target);
317+
LOG_INFO << "[SHARE-BITS] target=" << target.GetHex().substr(0, 20)
318+
<< " att=" << att.GetHex().substr(0, 20);
319+
}
309320
});
310321

311322
m_tracker.add(share);

src/impl/ltc/share_tracker.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,17 @@ class ShareTracker
524524
if (time <= 0)
525525
time = 1;
526526

527-
return (use_min_work ? interval.min_work : interval.work) / static_cast<uint32_t>(time);
527+
auto result = (use_min_work ? interval.min_work : interval.work) / static_cast<uint32_t>(time);
528+
{
529+
static int aps_log = 0;
530+
if (aps_log++ < 3)
531+
LOG_INFO << "[APS] dist=" << dist << " time=" << time
532+
<< " work=" << interval.work.GetHex().substr(0, 20)
533+
<< " min_work=" << interval.min_work.GetHex().substr(0, 20)
534+
<< " use_min=" << use_min_work
535+
<< " result=" << result.GetHex().substr(0, 20);
536+
}
537+
return result;
528538
}
529539

530540
// -- Share target computation --

0 commit comments

Comments
 (0)