Skip to content

doge: correct submitblock/submitauxblock reward accounting (#744)#788

Merged
frstrtr merged 1 commit into
masterfrom
doge/broadcaster-submitauxblock-fallback
Jul 22, 2026
Merged

doge: correct submitblock/submitauxblock reward accounting (#744)#788
frstrtr merged 1 commit into
masterfrom
doge/broadcaster-submitauxblock-fallback

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 21, 2026

Copy link
Copy Markdown
Owner

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_blocks commits current_work.block_hash to c2pool's self-built PPLNS block hash (merged_mining.cpp:1215-1216), which dogecoind's AuxpowMiner never minted via createauxblocksubmitauxblock of 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 its aux_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.

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
frstrtr force-pushed the doge/broadcaster-submitauxblock-fallback branch from bdc96b3 to 8d39fad Compare July 21, 2026 02:16
@frstrtr frstrtr changed the title doge: wire canonical submitauxblock as a run-path fallback (#744) doge: correct submitblock/submitauxblock reward accounting (#744) Jul 21, 2026
@frstrtr
frstrtr force-pushed the doge/broadcaster-submitauxblock-fallback branch from 8d39fad to 5bc8a7c Compare July 21, 2026 02:59
@frstrtr
frstrtr marked this pull request as ready for review July 22, 2026 05:08
@frstrtr
frstrtr merged commit e372155 into master Jul 22, 2026
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant