Skip to content

Commit aa8d768

Browse files
author
MarcoFalke
committed
Merge #17946: Fix GBT: Restore "!segwit" and "csv" to "rules" key
412d5fe QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: #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. ACKs for top commit: sipa: ACK 412d5fe jnewbery: Tested ACK 412d5fe. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615
2 parents d44dd51 + 412d5fe commit aa8d768

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/rpc/mining.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
787787
result.pushKV("capabilities", aCaps);
788788

789789
UniValue aRules(UniValue::VARR);
790+
aRules.push_back("csv");
791+
if (!fPreSegWit) aRules.push_back("!segwit");
790792
UniValue vbavailable(UniValue::VOBJ);
791793
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
792794
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);

test/functional/feature_segwit.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,7 @@ def run_test(self):
108108
assert tmpl['sigoplimit'] == 20000
109109
assert tmpl['transactions'][0]['hash'] == txid
110110
assert tmpl['transactions'][0]['sigops'] == 2
111-
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
112-
assert tmpl['sizelimit'] == 1000000
113-
assert 'weightlimit' not in tmpl
114-
assert tmpl['sigoplimit'] == 20000
115-
assert tmpl['transactions'][0]['hash'] == txid
116-
assert tmpl['transactions'][0]['sigops'] == 2
111+
assert '!segwit' not in tmpl['rules']
117112
self.nodes[0].generate(1) # block 162
118113

119114
balance_presetup = self.nodes[0].getbalance()
@@ -213,6 +208,7 @@ def run_test(self):
213208
assert tmpl['sigoplimit'] == 80000
214209
assert tmpl['transactions'][0]['txid'] == txid
215210
assert tmpl['transactions'][0]['sigops'] == 8
211+
assert '!segwit' in tmpl['rules']
216212

217213
self.nodes[0].generate(1) # Mine a block to clear the gbt cache
218214

0 commit comments

Comments
 (0)