Skip to content

Commit 3a4d0a4

Browse files
committed
Fix merged mining stuck height: force aux work refresh after block submit
After submitting a merged block (submitblock or submitauxblock), the poll_loop skipped createauxblock refresh because the daemon's best tip hadn't changed yet (race with p2pool's submission at same height). Result: c2pool kept mining against the same stale template, submitting duplicate blocks at the same height repeatedly (all orphaned). Fix: clear chain.last_tip after every block submission to force refresh_aux_work() to call createauxblock on next poll cycle.
1 parent f888b94 commit 3a4d0a4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/c2pool/merged/merged_mining.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ void MergedMiningManager::try_submit_merged_blocks(
784784
<< payouts.size() << " payout outputs)";
785785
bool ok = chain.rpc->submit_block(block_hex);
786786
LOG_INFO << "[MM:" << chain.config.symbol << "] submit_block returned ok=" << ok;
787+
// Force aux work refresh on next poll — the tip may have changed
788+
chain.last_tip.clear();
787789
try {
788790
record_discovered_block(chain, ok, parent_hash.GetHex());
789791
LOG_INFO << "[MM:" << chain.config.symbol << "] record_discovered_block OK";
@@ -827,6 +829,8 @@ void MergedMiningManager::submit_aux_and_relay(ChainState& chain, const std::str
827829
const std::string& parent_hash_hex)
828830
{
829831
bool ok = chain.rpc->submit_aux_block(chain.current_work.block_hash, auxpow);
832+
// Force aux work refresh — tip has changed
833+
chain.last_tip.clear();
830834
record_discovered_block(chain, ok, parent_hash_hex);
831835
if (ok) {
832836
// Fetch the accepted block and relay via P2P for fast propagation

0 commit comments

Comments
 (0)