-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Drop script_pub_key arg from createNewBlock #31318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31318. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
The PR was prompted because I noticed in #31283 I had to needlessly pass |
7879dbf to
523bde0
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
523bde0 to
bfdef23
Compare
|
Renamed to |
bfdef23 to
ab2e06d
Compare
|
Forgot to modify |
|
I'm not sure why this is really an improvement. Can you elaborate on why no external user would want to pass in a script pubkey directly, instead of manually manipulating the coinbase in the block template? |
|
Afaik the only way external users make blocks today is the Similarly in Unless you're solo mining, the pool is going to add its own outputs, manipulate the extra nonce, add its own name, etc. Even with a solo pool (a weird concept) you would configure the payout address in that software, not in the node. There is a way in Stratum v2 to specify a list of outputs that you want in the coinbase. In my current implementation we use this to include the witness commitment, but nothing else. In the longer run we could expand the interface to specify more outputs. The special case for that is a single payout address that takes all the money from the block. That could be used for solo mining with a single small ASIC that doesn't need to grind the extra nonce (up to about 100 TH/s with BIP320). But that's fairly niche use case. As soon as you use Stratum v1 / v2 software you typically pass a payout address to the the pool software, not to the node. |
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK . It seems like a nice improvement to not require specifying an option that won't typically be used. But I'm a little hazy on the details of this. I think better documentation could help. Left a suggestion and some questions below.
ab2e06d to
42f880a
Compare
|
Rebased to avoid spurious CI failure. I'll take a look later if for any of the tests I can drop their custom coinbase output. |
|
Thank you for spelling this out @Sjors. I also like ryanofsky's idea of adding the Concept ACK |
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 1dfc54d87c7b35cc93cfb81cc2a46c9e8eae7194. Left a style suggestion, and a suggestion to split up the first commit, if we want to do that. But these can be ignored and this all looks good as-is. Makes a lot of sense to not make a parameter which should only be used for testing a required argument.
src/node/miner.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "Drop script_pub_key arg from createNewBlock" (42f880aeb080070a42229d0bccd517100a3fe7fb)
Would suggest using '*' instead of .value() since this code isn't intending to trigger the std::bad_optional_access exception, and to make it more obvious a dereference is happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed coinbase_output_script to no longer be std::optional.
1dfc54d to
d06f23b
Compare
|
Rebased after #31122. I changed I split the main commit into three parts:
|
Providing a script for the coinbase transaction is only done in test code and for CPU solo mining. Production miners use the getblocktemplate RPC which omits the coinbase transaction entirely from its block template, leaving it to external (pool) software to construct it. A coinbase script can still be passed via BlockCreateOptions instead. A temporary overload is added so that the test can be modified in the next commit.
This removes the temporary overload added in the previous commit. Also drop unneeded custom coinbase output scripts.
027ce3e to
52fd151
Compare
|
Rebased after #31112. |
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 52fd151. No change since last review other than rebase
sedited
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-ACK 52fd151
vasild
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 52fd151
Looks like a nice cleanup of the interface.
| //! @file node/types.h is a home for public enum and struct type definitions | ||
| //! that are used by internally by node code, but also used externally by wallet | ||
| //! or GUI code. | ||
| //! that are used by internally by node code, but also used externally by wallet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, was there before this PR, if you retouch, you can drop the excess "by":
| //! that are used by internally by node code, but also used externally by wallet, | |
| //! that are used internally by node code, but also used externally by wallet, |
Providing a script for the coinbase transaction is only done in test code and for (unoptimized) CPU solo mining.
Production miners use the
getblocktemplateRPC which omits the coinbase transaction entirely from its block template, leaving it to external (pool) software to construct it.This commit removes the
script_pub_key argumentfromcreateNewBlock()in the Mining interface.A coinbase script can still be passed via
BlockCreateOptionsinstead. Tests are modified to do so.