-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Mining: Enforce that segwit option must be set in GBT #14811
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
Concept ACK |
Looks like a nice cleanup, and it might encourage miners running mining hardware or mining software that can't yet handle segwit transactions to upgrade. Though, I can't evaluate how much of a hassle it would be for them, so I won't review this conceptually. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
Concept ACK |
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.
Is there a reason to not make it implicit and optionally return a warning?
Otherwise could update getblocktemplate
description to mention that template_request.rules
is not optional, at least be {"rules":["segwit"]}
?
The only time it wouldn't be present is in the case of non-segwit miners. In that case, implying it would likely result in them producing invalid blocks. |
@luke-jr required or implicit, they still/eventually have to update. |
Yes, but it's much nicer to have the miner give them an error immediately upon updating bitcoind, than find out weeks later that they've been wasting electricity mining invalid blocks. |
@promag Silently losing money (and mining invalid blocks!) is not an acceptable failure mode. |
Concept ACK after IRC discussion. Suggest adding a "Mining" section to the release notes to make this more visible to the small percentage of miners this may impact. |
510952b
to
62a4992
Compare
Done |
62a4992
to
66c0f5b
Compare
utACK 66c0f5bde1ba2c188933115337cf26a007d979be |
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.
utACK 66c0f5b, just 2 nits for your consideration.
doc/release-notes.md
Outdated
@@ -182,6 +189,8 @@ in the Low-level Changes section below. | |||
P2SH-P2WPKH, and P2SH-P2WSH. Requests for P2WSH and P2SH-P2WSH accept | |||
an additional `witnessscript` parameter. | |||
|
|||
- See the *Mining* section for changes to `getblocktemplate`. |
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, use anchor: See the [Mining](#mining) ...
.
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.
Updated in the latest commit.
src/rpc/mining.cpp
Outdated
// don't). | ||
bool fSupportsSegwit = setClientRules.find(segwit_info.name) != setClientRules.end(); | ||
// GBT must be called with 'segwit' set in the rules | ||
if (setClientRules.find(segwit_info.name) == setClientRules.end()) { |
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, count()
instead of find()
?
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.
thanks. Updated
66c0f5b
to
6c57746
Compare
Thanks @promag . I've taken both of those nits. |
utACK 6c57746, no problem |
re-utACK 6c577469c7 |
Calling getblocktemplate without the segwit rule specified is most likely a client error, since it results in lower fees for the miner. Prevent this client error by failing getblocktemplate if called without the segwit rule specified.
GBT must now be called with the segwit rule.
6c57746
to
d2ce315
Compare
re-utACK d2ce315 (Only change was rebase and making "rules" as well as "template_request" required arguments) |
tACK d2ce315 |
d2ce315 [docs] add release note for change to GBT (John Newbery) 0025c9e [mining] segwit option must be set in GBT (John Newbery) Pull request description: Calling getblocktemplate without the segwit rule specified is most likely a client error, since it results in lower fees for the miner. Prevent this client error by failing getblocktemplate if called without the segwit rule specified. Of the previous 1000 blocks (measured at block [551591 (hash 0x...173c811)](https://blockstream.info/block/000000000000000000173c811e79858808abc3216af607035973f002bef60a7a)), 991 included segwit transactions. Tree-SHA512: 7933b073d72683c9ab9318db46a085ec19a56a14937945c73f783ac7656887619a86b74db0bdfcb8121df44f63a1d6a6fb19e98505b2a26a6a8a6e768e442fee
Upstream Bitcoin contains a change (bitcoin/bitcoin#14811) that forces miners calling getblocktemplate to indicate segwit support. This is not an issue for Namecoin, though, since this is just about giving miners the option to opt-out of segwit *once activated*. Until activation, segwit transactions will still be ignored, independently of the choice made for getblocktemplate.
Calling getblocktemplate without the segwit rule specified is most
likely a client error, since it results in lower fees for the miner.
Prevent this client error by failing getblocktemplate if called without
the segwit rule specified.
Of the previous 1000 blocks (measured at block 551591 (hash 0x...173c811)), 991 included segwit transactions.