mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge #17946: Fix GBT: Restore "!segwit" and "csv" to "rules" key
412d5fe879
QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr)2abe8cc3b7
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: ACK412d5fe879
jnewbery: Tested ACK412d5fe879
. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615
This commit is contained in:
commit
aa8d76806c
2 changed files with 4 additions and 6 deletions
|
@ -787,6 +787,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);
|
||||
|
|
|
@ -108,12 +108,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||
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()
|
||||
|
@ -213,6 +208,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||
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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue