Skip to content

Add Stratum reconnect logic to recover from BrokenPipeError - #1

Open
Welshdag wants to merge 1 commit into
BlockdagEngineering:mainfrom
Welshdag:main
Open

Add Stratum reconnect logic to recover from BrokenPipeError#1
Welshdag wants to merge 1 commit into
BlockdagEngineering:mainfrom
Welshdag:main

Conversation

@Welshdag

Copy link
Copy Markdown

Summary

  • Reconnects to the Stratum pool with exponential backoff when the connection drops (BrokenPipeError, EOF, or other socket errors)
  • Re-subscribes/re-authorizes after reconnecting, and retries an in-flight mining.submit once after reconnecting
  • Reader thread now reconnects on read errors or pool-initiated disconnects instead of leaving the miner in a stuck "connected" state

Test plan

  • python3 -m py_compile bdag_gpu_miner/gpu_scrypt_miner.py
  • Manual test against a local fake Stratum server: dropped the connection mid-submit, confirmed the miner reconnects, re-authorizes, and the retried submit is accepted
  • tests/test_hashing.py still passes

When the pool connection drops mid-submit, send() now reconnects with
backoff and retries the request once instead of crashing the mining
loop. The reader thread also reconnects on EOF or socket errors.
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