Skip to content

Commit 279f944

Browse files
committed
QA: Test GBT size/weight limit values
1 parent 9fc7f0b commit 279f944

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

qa/rpc-tests/segwit.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,14 @@ def run_test(self):
130130
print("Verify sigops are counted in GBT with pre-BIP141 rules before the fork")
131131
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
132132
tmpl = self.nodes[0].getblocktemplate({})
133+
assert(tmpl['sizelimit'] == 1000000)
134+
assert('weightlimit' not in tmpl)
133135
assert(tmpl['sigoplimit'] == 20000)
134136
assert(tmpl['transactions'][0]['hash'] == txid)
135137
assert(tmpl['transactions'][0]['sigops'] == 2)
136138
tmpl = self.nodes[0].getblocktemplate({'rules':['segwit']})
139+
assert(tmpl['sizelimit'] == 1000000)
140+
assert('weightlimit' not in tmpl)
137141
assert(tmpl['sigoplimit'] == 20000)
138142
assert(tmpl['transactions'][0]['hash'] == txid)
139143
assert(tmpl['transactions'][0]['sigops'] == 2)
@@ -241,6 +245,8 @@ def run_test(self):
241245
print("Verify sigops are counted in GBT with BIP141 rules after the fork")
242246
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
243247
tmpl = self.nodes[0].getblocktemplate({'rules':['segwit']})
248+
assert(tmpl['sizelimit'] >= 3999577) # actual maximum size is lower due to minimum mandatory non-witness data
249+
assert(tmpl['weightlimit'] == 4000000)
244250
assert(tmpl['sigoplimit'] == 80000)
245251
assert(tmpl['transactions'][0]['txid'] == txid)
246252
assert(tmpl['transactions'][0]['sigops'] == 8)
@@ -250,6 +256,8 @@ def run_test(self):
250256
try:
251257
tmpl = self.nodes[0].getblocktemplate({})
252258
assert(len(tmpl['transactions']) == 1) # Doesn't include witness tx
259+
assert(tmpl['sizelimit'] == 1000000)
260+
assert('weightlimit' not in tmpl)
253261
assert(tmpl['sigoplimit'] == 20000)
254262
assert(tmpl['transactions'][0]['hash'] == txid)
255263
assert(tmpl['transactions'][0]['sigops'] == 2)

0 commit comments

Comments
 (0)