doge: correct submitblock/submitauxblock reward accounting (#744)#788
Merged
Conversation
Re-audit (review of the prior revision) showed submitauxblock is NOT a viable fallback for a PPLNS merged block: DOGE ships multiaddress=true and rebuild_cached_blocks commits current_work.block_hash to c2pool's self-built PPLNS block hash, which dogecoind's AuxpowMiner never minted via createauxblock, so submitauxblock of it is always rejected -- and the daemon's own template pays its aux address, violating the trustless merged-payout invariant. The viable DOGE dual-path is full-block submitblock (ARM B) + the independent embedded P2P relay (ARM A), which master already wires; there is no aux fallback to add. This revision drops the misguided aux-fallback wiring and instead fixes the genuine latent reward-accounting bugs it surfaced: - try_submit_merged_blocks: keep the P2P relay UNCONDITIONAL (fires even when the local submitblock is rejected -- it is an independent arm that can still land the block via peers). Documented why submitauxblock is not a valid fallback. - AuxChainRPC::submit_block: BIP22 -- a submitblock REJECTION is a non-null string RESULT, not a JSON-RPC error, so the old 'return true unless throw' mis-recorded a rejected block as WON. Inspect the result: null => accepted, duplicate/inconclusive => accepted, any other non-null string => rejected. - AuxChainRPC::submit_aux_block: honor the BOOLEAN result (true=accept, false=reject) instead of assuming success on no-throw (latent; no run-path caller today, corrected for safety). Broadcast/RPC-result path only -- no PoW, share format, aux commitment, or PPLNS math touched (consensus-neutral). Builds clean (c2pool_merged_mining + c2pool-ltc).
frstrtr
force-pushed
the
doge/broadcaster-submitauxblock-fallback
branch
from
July 21, 2026 02:16
bdc96b3 to
8d39fad
Compare
frstrtr
force-pushed
the
doge/broadcaster-submitauxblock-fallback
branch
from
July 21, 2026 02:59
8d39fad to
5bc8a7c
Compare
frstrtr
marked this pull request as ready for review
July 22, 2026 05:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #744. Revised after review — the original "wire submitauxblock as a fallback" approach was wrong; this PR now corrects the reward-accounting bugs it surfaced instead.
Why submitauxblock is NOT a viable DOGE fallback
DOGE ships
multiaddress=true;rebuild_cached_blockscommitscurrent_work.block_hashto c2pool's self-built PPLNS block hash (merged_mining.cpp:1215-1216), which dogecoind'sAuxpowMinernever minted viacreateauxblock→submitauxblockof it is rejected 100% of the time ("block hash unknown"). The AuxPoW proof is cryptographically bound to that self-built hash, and the daemon's own template would pay itsaux_payout_address(not the PPLNS set) — violating the trustless merged-payout invariant. So the canonical-aux path is only reachable as a primary non-PPLNS mode, never as a fallback for the current one.The viable DOGE dual-path — already wired in master — is full-block submitblock (ARM B) + the independent embedded P2P relay (ARM A). There is no aux fallback to add.
What this PR does (reward-accounting fixes)
try_submit_merged_blocks: keep the P2P relay unconditional (it fires even when local submitblock is rejected — an independent arm that can still land the block via peers). Restores the arm the prior revision had regressed, and documents why submitauxblock is not a valid fallback.AuxChainRPC::submit_block(Finding 1): BIP22 — a submitblock rejection is a non-null string result, not a JSON-RPC error. The old "return true unless throw" mis-recorded a rejected block as WON. Now inspects the result:null→accepted,duplicate/inconclusive→accepted, any other non-null string→rejected.AuxChainRPC::submit_aux_block(Finding 4): honor the boolean result instead of assuming success on no-throw (latent; corrected for safety).Safety
Broadcast/RPC-result path only — no PoW, share format, aux commitment, or PPLNS math touched (consensus-neutral). Builds clean (
c2pool_merged_mining+c2pool-ltc).Draft — for re-review, not merge.