revert(net): remove header-accept RandomX check; keep nMinimumChainWork + #8
An adversarial re-review found the header-accept RandomX check (b9fdc7981+7e9b2c661header-PoW +d2124a303defer) to be a persistent source of consensus-liveness bugs: it derives the RandomX key from the ACTIVE chain (hush_chainactive), the wrong branch for reorg/side-branch/catch-up headers, so it repeatedly false-rejected validly-mined headers and DoS(100)-hard-banned honest peers (IBD-tail catch-up and deep-reorg cases); the defer fix and an extend-tip fix each addressed one case while leaving/creating others (an extend-tip variant re-opened an unbounded post-IBD side-branch flood). It only mitigated a low-harm resource DoS -- forged headers bloat mapBlockIndex memory/ disk but are never SELECTED (nMinimumChainWork) and the full RandomX + target check still runs at block-connect. Revert to fCheckPOW=0 at header-accept (original behavior). A comment in AcceptBlockHeader records that any re-attempt must derive the key from the header's OWN ancestry (pindexPrev->GetAncestor), never the active chain. Also hardens two issues the same review found: - #8 IBD header cap now bounds against the VALIDATED chainActive.Height() (attacker-hard) instead of pindexBestHeader, which a forward-extending flood advanced in lockstep, defeating the cap. - opreturn_burn only emits a change output above the dust threshold; a sub-dust change made the returned tx non-standard/unrelayable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6437,8 +6437,11 @@ UniValue opreturn_burn(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// Return the unspent surplus (selected inputs - burn amount - txfee) as change to a
|
||||
// wallet-owned address; without this the entire surplus is silently paid as miner fee.
|
||||
CAmount change = normalInputs - nAmount - txfee;
|
||||
if ( change > 0 )
|
||||
mtx.vout.push_back(CTxOut(change, GetScriptForDestination(myPubkey.GetID())));
|
||||
// Only emit change if it clears the dust threshold; a sub-dust output would make the tx
|
||||
// non-standard (unrelayable). Sub-dust surplus is folded into the fee (standard wallet behavior).
|
||||
CTxOut changeOut(change, GetScriptForDestination(myPubkey.GetID()));
|
||||
if ( change > 0 && !changeOut.IsDust(::minRelayTxFee) )
|
||||
mtx.vout.push_back(changeOut);
|
||||
ret.push_back(Pair("hex", EncodeHexTx(mtx)));
|
||||
return(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user