#16060 removed CSV & segwit from versionbits, breaking the “rules” key returned by GBT.
Without this, miners don’t know they’re mining segwit blocks, and should fall back to pre-segwit block creation.
They have been missing since buried deployments were merged
"!"
and/or bad name/description of the gbt_force
flag.)
@luke-jr : The rules field hasn’t been populated with “!segwit” since 0.15 (#9955 changed the behaviour so that “segwit” would be included as a rule instead of “!segwit”).
In IRC you stated that “miners have no way to know what rules are being used and might produce invalid blocks”. Do you have any additional information about that? In what way would miners produce invalid blocks? Do you know of any miners that have had a problem because of this?
I don’t have any objection to this change, but I’d like to better understand how miners have been impacted by this.
#9955 introduced a bug, sure, but that bug would only have impacted Segwit-unaware miners. Segwit-aware miners would have continued to work correctly because they saw that segwit was an active rule.
Removing the rule entirely means that sigops are counted differently, and transactions may not include witness data. I don’t know if there are any real-world miners impacted by this, but it is at least theoretically possible (IIRC, at least some branches of Eloipool support a safety trim based on sigop counts).
that bug would only have impacted Segwit-unaware miners.
I think you have this the wrong way round. Segwit-unaware miners would see “segwit” in the rules, but according to BIP 9:
Without this ["!"] prefix, GBT clients may assume the rule will not impact usage of the template as-is;
and so the segwit-unaware miner would use the template, but not be able to add the witness commitment to the coinbase.
sigops are counted differently
Since #14811, the GBT request must include “segwit” in the rule array, so sigops are always counted according to BIP 141 rules. Whether or not the return object includes “segwit” in the rules doesn’t change this.
In any case, I think it’s fine to make this change because it doesn’t really matter. Segwit has been active for two years and all miners using 0.18 onwards have to set “segwit” in the rules. I find it very hard to believe that any are reading what’s returned in the rules field.
I think you have this the wrong way round. Segwit-unaware miners would see “segwit” in the rules,
They would fail by mining invalid blocks, instead of failing explicitly. Either way, they fail.
Segwit-capable miners, on the other hand, shouldn’t fail, but might because they think they’re mining a non-segwit block.
Since #14811, the GBT request must include “segwit” in the rule array, so sigops are always counted according to BIP 141 rules.
The request rule doesn’t affect sigop counting, only indicates the client can understand a segwit template. Sigop counting is enabled only when the template has segwit in its rules list.
206@@ -212,6 +207,7 @@ def run_test(self):
207 assert tmpl['sigoplimit'] == 80000
208 assert tmpl['transactions'][0]['txid'] == txid
209 assert tmpl['transactions'][0]['sigops'] == 8
210+ assert '!segwit' in tmpl['rules']
'csv'
being present here?
FYI without this mining with ckpool breaks since it will only try to produce segwit blocks when the segwit rule is seen. @jameshilliard can you point me at the code that does that? The only getblocktemplate
"rules"
handling code I was able to find in ckpool was checking that the gbt response doesn’t contain an unknown rule: https://bitbucket.org/ckolivas/ckpool/src/73f560cf3144f824823077c1b9e1663d89823ed7/src/bitcoin.c#lines-127
Thanks for the references, James.
Tested ACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db.
This this need a new rc? Maybe not for a two-line change?
I suggest either creating a backport pr or bringing it up in the meeting, so that it is not forgotten.
luke-jr
ryanofsky
jnewbery
jameshilliard
MarcoFalke
sipa
Labels
RPC/REST/ZMQ
Mining
Milestone
0.19.2