Skip to content

Commit a2d9d90

Browse files
committed
fixup! fixup! feature_discount_ct: some txs can return 2 different weights, adapt the test to it
1 parent 11c57b0 commit a2d9d90

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

test/functional/feature_discount_ct.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ def run_test(self):
8282
assert_equal(tx['fee']['bitcoin'], Decimal('-0.00000326'))
8383
assert_equal(decoded['vsize'], 326)
8484
# tx weight can be 1301 or 1302, accept both
85-
assert_approx(decoded['weight'], 1301, 1)
85+
assert_approx(decoded['weight'], 1301.5, 0.5)
8686
self.generate(node0, 1)
8787
tx = node1.getrawtransaction(txid, True)
88-
assert_approx(tx['discountweight'], 1301, 1)
88+
assert_approx(tx['discountweight'], 1301.5, 0.5)
8989
assert_equal(tx['discountvsize'], 326)
9090

9191
self.log.info("Send confidential tx to node 0")
@@ -101,10 +101,10 @@ def run_test(self):
101101
assert_equal(tx['fee']['bitcoin'], Decimal('-0.00002575'))
102102
assert_equal(decoded['vsize'], 2575)
103103
# tx weight can be 10299 or 10300, accept both
104-
assert_approx(decoded['weight'], 10299, 1)
104+
assert_approx(decoded['weight'], 10299.5, 0.5)
105105
self.generate(node0, 1)
106106
tx = node1.getrawtransaction(txid, True)
107-
assert_approx(tx['discountweight'], 1301, 1)
107+
assert_approx(tx['discountweight'], 1301.5, 0.5)
108108
assert_equal(tx['discountvsize'], 326) # node1 has discountvsize
109109

110110
self.log.info("Send explicit tx to node 1")
@@ -120,10 +120,10 @@ def run_test(self):
120120
assert_equal(tx['fee']['bitcoin'], Decimal('-0.00000326'))
121121
assert_equal(decoded['vsize'], 326)
122122
# tx weight can be 1301 or 1302, accept both
123-
assert_approx(decoded['weight'], 1301, 1)
123+
assert_approx(decoded['weight'], 1301.5, 0.5)
124124
self.generate(node0, 1)
125125
tx = node1.getrawtransaction(txid, True)
126-
assert_approx(tx['discountweight'], 1301, 1)
126+
assert_approx(tx['discountweight'], 1301.5, 0.5)
127127
assert_equal(tx['discountvsize'], 326)
128128

129129
self.log.info("Send confidential (undiscounted) tx to node 1")
@@ -139,10 +139,10 @@ def run_test(self):
139139
assert_equal(tx['fee']['bitcoin'], Decimal('-0.00002575'))
140140
assert_equal(decoded['vsize'], 2575)
141141
# tx weight can be 10299 or 10300, accept both
142-
assert_approx(decoded['weight'], 10299, 1)
142+
assert_approx(decoded['weight'], 10299.5, 0.5)
143143
self.generate(node0, 1)
144144
tx = node1.getrawtransaction(txid, True)
145-
assert_approx(tx['discountweight'], 1301, 1)
145+
assert_approx(tx['discountweight'], 1301.5, 0.5)
146146
assert_equal(tx['discountvsize'], 326) # node1 has discountvsize
147147

148148
self.log.info("Send confidential (discounted) tx to node 1")
@@ -167,8 +167,8 @@ def run_test(self):
167167
assert_equal(decoded['fee'][bitcoin], Decimal('0.00000326'))
168168
assert_equal(decoded['vsize'], 2575)
169169
# tx weight can be 10299 or 10300, accept both
170-
assert_approx(decoded['weight'], 10299, 1)
171-
assert_approx(decoded['discountweight'], 1301, 1)
170+
assert_approx(decoded['weight'], 10299.5, 0.5)
171+
assert_approx(decoded['discountweight'], 1301.5, 0.5)
172172
assert_equal(decoded['discountvsize'], 326)
173173

174174
# node0 only has vsize
@@ -198,8 +198,8 @@ def run_test(self):
198198
assert_equal(decoded['fee'][bitcoin], Decimal('0.00000033'))
199199
assert_equal(decoded['vsize'], 2575)
200200
# tx weight can be 10299 or 10300, accept both
201-
assert_approx(decoded['weight'], 10299, 1)
202-
assert_approx(decoded['discountweight'], 1301, 1)
201+
assert_approx(decoded['weight'], 10299.5, 0.5)
202+
assert_approx(decoded['discountweight'], 1301.5, 0.5)
203203
assert_equal(decoded['discountvsize'], 326)
204204
# node0 only has vsize
205205
tx = node0.getrawtransaction(txid, True)

0 commit comments

Comments
 (0)