Skip to content

Commit a78f95a

Browse files
committed
Merge #8531: [qa] abandonconflict: Use assert_equal
fa64306 [qa] abandonconflict: Use assert_equal (MarcoFalke)
2 parents 733035b + fa64306 commit a78f95a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

qa/rpc-tests/abandonconflict.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def run_test(self):
6868

6969
# In mempool txs from self should increase balance from change
7070
newbalance = self.nodes[0].getbalance()
71-
assert(newbalance == balance - Decimal("30") + Decimal("24.9996"))
71+
assert_equal(newbalance, balance - Decimal("30") + Decimal("24.9996"))
7272
balance = newbalance
7373

7474
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
@@ -78,16 +78,16 @@ def run_test(self):
7878
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
7979

8080
# Verify txs no longer in mempool
81-
assert(len(self.nodes[0].getrawmempool()) == 0)
81+
assert_equal(len(self.nodes[0].getrawmempool()), 0)
8282

8383
# Not in mempool txs from self should only reduce balance
8484
# inputs are still spent, but change not received
8585
newbalance = self.nodes[0].getbalance()
86-
assert(newbalance == balance - Decimal("24.9996"))
86+
assert_equal(newbalance, balance - Decimal("24.9996"))
8787
# Unconfirmed received funds that are not in mempool, also shouldn't show
8888
# up in unconfirmed balance
8989
unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance()
90-
assert(unconfbalance == newbalance)
90+
assert_equal(unconfbalance, newbalance)
9191
# Also shouldn't show up in listunspent
9292
assert(not txABC2 in [utxo["txid"] for utxo in self.nodes[0].listunspent(0)])
9393
balance = newbalance
@@ -96,35 +96,35 @@ def run_test(self):
9696
# including that the child tx was also abandoned
9797
self.nodes[0].abandontransaction(txAB1)
9898
newbalance = self.nodes[0].getbalance()
99-
assert(newbalance == balance + Decimal("30"))
99+
assert_equal(newbalance, balance + Decimal("30"))
100100
balance = newbalance
101101

102102
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
103103
stop_node(self.nodes[0],0)
104104
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"])
105-
assert(len(self.nodes[0].getrawmempool()) == 0)
106-
assert(self.nodes[0].getbalance() == balance)
105+
assert_equal(len(self.nodes[0].getrawmempool()), 0)
106+
assert_equal(self.nodes[0].getbalance(), balance)
107107

108108
# But if its received again then it is unabandoned
109109
# And since now in mempool, the change is available
110110
# But its child tx remains abandoned
111111
self.nodes[0].sendrawtransaction(signed["hex"])
112112
newbalance = self.nodes[0].getbalance()
113-
assert(newbalance == balance - Decimal("20") + Decimal("14.99998"))
113+
assert_equal(newbalance, balance - Decimal("20") + Decimal("14.99998"))
114114
balance = newbalance
115115

116116
# Send child tx again so its unabandoned
117117
self.nodes[0].sendrawtransaction(signed2["hex"])
118118
newbalance = self.nodes[0].getbalance()
119-
assert(newbalance == balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996"))
119+
assert_equal(newbalance, balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996"))
120120
balance = newbalance
121121

122122
# Remove using high relay fee again
123123
stop_node(self.nodes[0],0)
124124
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
125-
assert(len(self.nodes[0].getrawmempool()) == 0)
125+
assert_equal(len(self.nodes[0].getrawmempool()), 0)
126126
newbalance = self.nodes[0].getbalance()
127-
assert(newbalance == balance - Decimal("24.9996"))
127+
assert_equal(newbalance, balance - Decimal("24.9996"))
128128
balance = newbalance
129129

130130
# Create a double spend of AB1 by spending again from only A's 10 output
@@ -143,15 +143,15 @@ def run_test(self):
143143

144144
# Verify that B and C's 10 BTC outputs are available for spending again because AB1 is now conflicted
145145
newbalance = self.nodes[0].getbalance()
146-
assert(newbalance == balance + Decimal("20"))
146+
assert_equal(newbalance, balance + Decimal("20"))
147147
balance = newbalance
148148

149149
# There is currently a minor bug around this and so this test doesn't work. See Issue #7315
150150
# Invalidate the block with the double spend and B's 10 BTC output should no longer be available
151151
# Don't think C's should either
152152
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
153153
newbalance = self.nodes[0].getbalance()
154-
#assert(newbalance == balance - Decimal("10"))
154+
#assert_equal(newbalance, balance - Decimal("10"))
155155
print("If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer")
156156
print("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
157157
print(str(balance) + " -> " + str(newbalance) + " ?")

0 commit comments

Comments
 (0)