Repository navigation
Conversation
This was referenced Oct 6, 2026
|
Why not just combine them into a single transaction? |
… job's coinbase as one binary transaction.
iohzrd
force-pushed
the
coinbase-binary-parts
branch
from
October 9, 2026 01:18
0a54867 to
fd8631d
Compare
Author
|
Done in fd8631d. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #24, whose two commits come first here. Review the last commit.
T_DATUM_STRATUM_COINBASEheld each coinbase twice: in ascii hex (coinb1,coinb2) and in binary (coinb1_bin,coinb2_bin). Only the coinbaser reads the hex, which it builds and then converts. Every share, notify and DATUM submission reads the binary parts, and two of those readers rebuilt the full transaction (coinb1, 12 zero extranonce bytes, coinb2) on the stack each time. BLAKE2b work sends the miner a 39-byte coinb1 computed from the commitment, so the coinb1/coinb2 split is now only needed for the share's coinbase section. Each job holds seven coinbases (MAX_COINBASE_TYPESplus the subsidy-only one), andupdate_stratum_jobzeroes the whole job, so every job slot's buffers become resident.T_DATUM_STRATUM_COINBASEis nowtxn[MAX_COINBASE_TXN_SIZE_BYTES], the coinbase transaction (coinb1, 12 zero extranonce bytes, coinb2), pluscoinb1_lenandcoinb2_len.T_DATUM_COINBASE_HEX(datum_coinbaser.h) holds one coinbase's coinb1 and coinb2 in hex.generate_base_coinbase_txns_for_stratum_jobandgenerate_coinbase_txns_for_stratum_jobcalloc one per coinbase they build and free them on return.generate_coinbase_txns_for_stratum_job_subtypebysizetakes the array.datum_coinbase_hex_to_binwritestxnand replaces the four copies of the hex-to-binary loop.client_mining_submitcopiestxnwith onememcpy. The share's coinbase section sendstxn[0, coinb1_len)and the coinb2 after the extranonce bytes, so the wire format is unchanged.datum_stratum_job_blake2b_commitment, which runs for each notify, hashestxnin place with the PoT byte substituted, throughdouble_sha256_with_byte(libsodium's incremental SHA-256). It used to copy the coinbase to the stack first. Its frame drops from 17056 bytes to 128 (gcc 16.2, x86_64, default CMake build).txn. Class 0 has the right version, input count, zero extranonce bytes, sequence, outputs and lock time; the other classes equal class 0; the subsidy-only coinbase pays the block reward. The existing commitment test compares the in-place hash with hashing a copy that has the PoT byte written.Every commit builds with
-Wall -Werrorand passes--test.