Skip to content

Commit fac5708

Browse files
author
MarcoFalke
committed
test: Use assert_equal over assert for easier debugging
1 parent a9d0cec commit fac5708

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/functional/feature_segwit.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from test_framework.test_framework import BitcoinTestFramework
4545
from test_framework.util import (
4646
assert_equal,
47+
assert_greater_than_or_equal,
4748
assert_is_hex_string,
4849
assert_raises_rpc_error,
4950
try_rpc,
@@ -124,11 +125,11 @@ def run_test(self):
124125
self.log.info("Verify sigops are counted in GBT with pre-BIP141 rules before the fork")
125126
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
126127
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
127-
assert tmpl['sizelimit'] == 1000000
128+
assert_equal(tmpl['sizelimit'], 1000000)
128129
assert 'weightlimit' not in tmpl
129-
assert tmpl['sigoplimit'] == 20000
130-
assert tmpl['transactions'][0]['hash'] == txid
131-
assert tmpl['transactions'][0]['sigops'] == 2
130+
assert_equal(tmpl['sigoplimit'], 20000)
131+
assert_equal(tmpl['transactions'][0]['hash'], txid)
132+
assert_equal(tmpl['transactions'][0]['sigops'], 2)
132133
assert '!segwit' not in tmpl['rules']
133134
self.generate(self.nodes[0], 1) # block 162
134135

@@ -232,11 +233,11 @@ def run_test(self):
232233
self.log.info("Verify sigops are counted in GBT with BIP141 rules after the fork")
233234
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
234235
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
235-
assert tmpl['sizelimit'] >= 3999577 # actual maximum size is lower due to minimum mandatory non-witness data
236-
assert tmpl['weightlimit'] == 4000000
237-
assert tmpl['sigoplimit'] == 80000
238-
assert tmpl['transactions'][0]['txid'] == txid
239-
assert tmpl['transactions'][0]['sigops'] == 8
236+
assert_greater_than_or_equal(tmpl['sizelimit'], 3999577) # actual maximum size is lower due to minimum mandatory non-witness data
237+
assert_equal(tmpl['weightlimit'], 4000000)
238+
assert_equal(tmpl['sigoplimit'], 80000)
239+
assert_equal(tmpl['transactions'][0]['txid'], txid)
240+
assert_equal(tmpl['transactions'][0]['sigops'], 8)
240241
assert '!segwit' in tmpl['rules']
241242

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

0 commit comments

Comments
 (0)