Skip to content

Commit

Permalink
Merge #19019: [0.20] Fix GBT: Restore "!segwit" and "csv" to "rules" key
Browse files Browse the repository at this point in the history
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:

  Original branch merges cleanly (no rebase needed)

  See also #17946

ACKs for top commit:
  jnewbery:
    utACK 412d5fe

Tree-SHA512: 8b269f7782c10f02dc245cc377d91f594474eade6a32184a49fa2ed3928d91917e4b83eefee6947bfb5ffff54eca2781f8cf2169c1f0ad3fefca1d4b3cf304dd
  • Loading branch information
MarcoFalke committed Jun 2, 2020
2 parents a62f0ed + 412d5fe commit e42c959
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
result.pushKV("capabilities", aCaps);

UniValue aRules(UniValue::VARR);
aRules.push_back("csv");
if (!fPreSegWit) aRules.push_back("!segwit");
UniValue vbavailable(UniValue::VOBJ);
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
Expand Down
8 changes: 2 additions & 6 deletions test/functional/feature_segwit.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ def run_test(self):
assert tmpl['sigoplimit'] == 20000
assert tmpl['transactions'][0]['hash'] == txid
assert tmpl['transactions'][0]['sigops'] == 2
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
assert tmpl['sizelimit'] == 1000000
assert 'weightlimit' not in tmpl
assert tmpl['sigoplimit'] == 20000
assert tmpl['transactions'][0]['hash'] == txid
assert tmpl['transactions'][0]['sigops'] == 2
assert '!segwit' not in tmpl['rules']
self.nodes[0].generate(1) # block 162

balance_presetup = self.nodes[0].getbalance()
Expand Down Expand Up @@ -213,6 +208,7 @@ def run_test(self):
assert tmpl['sigoplimit'] == 80000
assert tmpl['transactions'][0]['txid'] == txid
assert tmpl['transactions'][0]['sigops'] == 8
assert '!segwit' in tmpl['rules']

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

Expand Down

0 comments on commit e42c959

Please sign in to comment.