Sjors / bitcoin

Bitcoin Core integration/staging tree
https://bitcoin.org/en/download
MIT License
6 stars 10 forks source link

Mining interface: getCoinbaseMerklePath() and submitSolution() #53

Closed Sjors closed 1 week ago

Sjors commented 2 months ago

Builds on https://github.com/bitcoin/bitcoin/pull/30440

Because this new BlockTemplate interface causes the node to hold on to the template until the client releases it, there is now a more efficient way to communicate the block solution. Instead of having the send the full block, a client only needs to provide the nonce, timestamp, version fields and coinbase transaction.

This PR introduces submitSolution() for that. It's currently unused.

This PR also introduces getCoinbaseMerklePath(), which is needed in Stratum v2 to construct the merkle_path field of the NewTemplate message (see spec).

This last function uses BlockMerkleBranch which was moved to the test code in #13191. The reason for moving was that it was no longer used. This PR moves it back.

This PR does not change behaviour since both methods are unused.

Sjors commented 1 month ago

I dropped GetCoinBaseMerklePath (which was introduced in https://github.com/bitcoin/bitcoin/pull/27854) in favor of our existing BlockMerkleBranch. See updated PR description.

Sjors commented 1 month ago

Fuzzer failure is because I haven't rebased past https://github.com/bitcoin/bitcoin/pull/30598

Sjors commented 3 weeks ago

Rebased, but note that this doesn't build on cmake yet.

Sjors commented 1 week ago

Opened 30955 on the main repo.