@@ -1069,8 +1069,21 @@ nlohmann::json StratumSession::handle_submit(const nlohmann::json& params, const
10691069 if (sb != 0 )
10701070 pool_difficulty = chain::target_to_difficulty (chain::bits_to_target (sb));
10711071
1072- // Use VARDIFF as stratum acceptance threshold
1072+ // Use VARDIFF as stratum acceptance threshold — but validate the share
1073+ // against the difficulty THIS job was issued at (the target the miner
1074+ // actually received), not the live vardiff. A vardiff UP-retarget between
1075+ // job-issue and submit must not reject the miner's in-flight shares — that
1076+ // was the sole source of the DASH hotel's ~28% "Low difficulty share"
1077+ // rejects (X11 hashrate swings oscillate vardiff; every up-retarget
1078+ // rejected in-flight work). Faithful port of p2pool-dash work.py:477
1079+ // ("within 3 work events" grace): p2pool judges each share by its OWN job's
1080+ // target. Take the lenient lower of {live vardiff, this job's issued diff}.
1081+ // issued_difficulty==0 (unset) ⇒ old behavior. REWARD-NEUTRAL: the pool
1082+ // target + block-target checks below are independent and unchanged, so a
1083+ // real block (which far exceeds any vardiff) is unaffected on all coins.
10731084 double required_difficulty = vardiff_difficulty;
1085+ if (job.issued_difficulty > 0.0 && job.issued_difficulty < required_difficulty)
1086+ required_difficulty = job.issued_difficulty ;
10741087
10751088 // Build JobSnapshot BEFORE the rejection gate — needed for block-level
10761089 // checking which must run on ALL submissions, not just accepted ones.
@@ -1604,6 +1617,10 @@ void StratumSession::send_notify_work(bool force_clean, const uint256* frozen_be
16041617 je.version = version_u32;
16051618 je.gbt_block_nbits = gbt_block_nbits;
16061619 je.created_at = now_steady;
1620+ // Freeze the vardiff advertised with this job so the submit gate can
1621+ // validate a share against the target the miner actually received
1622+ // (p2pool-dash work.py:477 grace), immune to later vardiff retargets.
1623+ je.issued_difficulty = hashrate_tracker_.get_current_difficulty ();
16071624 active_jobs_[job_id] = std::move (je);
16081625 job_order_.push_back (job_id);
16091626 }
0 commit comments