@@ -556,38 +556,18 @@ class ShareTracker
556556 auto [height, last] = chain.get_height_and_last (prev_share_hash);
557557
558558 // Not enough chain depth for proper difficulty calculation.
559- // Walk backward to find the HARDEST (lowest target) bits in the chain
560- // — this approximates the network's stabilized share difficulty.
561- // On a fresh chain, early shares are easy but later shares ramp up.
562- // Using the hardest share's bits prevents c2pool from flooding the
563- // network with easy shares during bootstrap.
559+ // Use the chain HEAD's bits (most recent peer share) as the target.
560+ // The HEAD reflects the network's CURRENT stabilized difficulty,
561+ // unlike "hardest bits" which might pick from the ramp-up period.
562+ // Genesis nodes (no peers) fall back to MAX_TARGET.
564563 if (height < static_cast <int32_t >(PoolConfig::TARGET_LOOKBEHIND ))
565564 {
566- uint32_t best_bits = 0 ;
567- uint32_t best_max_bits = 0 ;
568- uint256 best_target;
569- best_target.SetHex (" ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
570-
571- auto pos = prev_share_hash;
572- for (int i = 0 ; i < height && !pos.IsNull () && chain.contains (pos); ++i) {
573- chain.get_share (pos).invoke ([&](auto * obj) {
574- auto target = chain::bits_to_target (obj->m_bits );
575- if (target < best_target) {
576- best_target = target;
577- best_bits = obj->m_bits ;
578- best_max_bits = obj->m_max_bits ;
579- }
580- });
581- uint256 next;
582- chain.get_share (pos).invoke ([&](auto * obj) { next = obj->m_prev_hash ; });
583- pos = next;
584- }
585- if (best_bits != 0 && best_max_bits != 0 ) {
586- return {best_max_bits, best_bits};
587- }
588- // No peers yet — fall back to MAX_TARGET
589- auto max_bits = chain::target_to_bits_upper_bound (MAX_TARGET );
590- return {max_bits, max_bits};
565+ // Not enough history for proper difficulty calculation.
566+ // Return {0, 0} to signal "don't create shares yet" — the caller
567+ // should only mine pseudoshares until the chain has enough depth
568+ // for compute_share_target to compute proper difficulty.
569+ // Genesis nodes (persist=false, no peers) can override this.
570+ return {0 , 0 };
591571 }
592572
593573 // Step 1: Derive target from pool hashrate
0 commit comments