Skip to content

Fix large PPLNS Stratum job handling - #807

Open
Roalkege wants to merge 1 commit into
BitMaker-hub:mainfrom
Roalkege:fix/large-pplns-stratum-jobs
Open

Fix large PPLNS Stratum job handling#807
Roalkege wants to merge 1 commit into
BitMaker-hub:mainfrom
Roalkege:fix/large-pplns-stratum-jobs

Conversation

@Roalkege

Copy link
Copy Markdown

Summary

Fixes an issue where NerdMiner remained at 0 KH/s when connected to pools that send large Stratum mining.notify
messages, such as public-pool.io:13333.

These PPLNS jobs can contain a significantly larger coinbase transaction than typical solo-pool jobs.

Root cause

Two size limitations prevented these jobs from being processed correctly:

  1. The fixed 4 KB ArduinoJson document was too small to classify and parse large mining.notify messages.
  2. Coinbase data was copied into a fixed 512-byte buffer, truncating coinbase transactions longer than 511 characters.

As a result, large jobs were either discarded during JSON parsing or hashed using incomplete coinbase data.

Changes

  • Classify Stratum messages using an ArduinoJson filter so large unused fields are not copied into the JSON document.
  • Parse mining.notify messages in zero-copy mode.
  • Store Merkle branches independently of the temporary JSON input buffer.
  • Hash the complete coinbase transaction incrementally in bounded chunks.
  • Avoid unnecessary copies of large mining-job structures.
  • Release large coinbase strings after the block header has been prepared.
  • Fix an out-of-bounds null terminator in the Merkle-root buffer.

Testing

Tested with:

  • Pool: public-pool.io
  • Port: 13333
  • Device: LilyGO T-Display-S3
  • PlatformIO environment: NerdminerV2

Results:

  • Large PPLNS jobs are parsed successfully.
  • Multiple subsequent mining.notify jobs are accepted.
  • No watchdog resets or crash loops.
  • Stable hashrate of approximately 247–253 KH/s.
  • Currently the PPLNS Pool ignores the suggest_difficulty command and we get diff 1 Jobs :/

The changes also compile successfully for:

  • NerdminerV2 — ESP32-S3
  • ESP32-2432S028R — classic ESP32

Before

Parsing of the large mining.notify message failed
0 KHashes
0.00 KH/s

## After

Parsing Method [MINING NOTIFY]
merkle sha: ...
Completed 12020 Khashes, avg. hashrate 245.5 KH/s

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