Skip to content

Commit fa21983

Browse files
author
MarcoFalke
committed
qa: Style-only fixes in touched files
1 parent 003a47f commit fa21983

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

test/functional/wallet_abandonconflict.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313
from decimal import Decimal
1414

1515
from test_framework.test_framework import BitcoinTestFramework
16-
from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes, disconnect_nodes, sync_blocks, sync_mempools
16+
from test_framework.util import (
17+
assert_equal,
18+
assert_raises_rpc_error,
19+
connect_nodes,
20+
disconnect_nodes,
21+
sync_blocks,
22+
sync_mempools,
23+
)
24+
1725

1826
class AbandonConflictTest(BitcoinTestFramework):
1927
def set_test_params(self):
@@ -40,7 +48,7 @@ def run_test(self):
4048

4149
sync_blocks(self.nodes)
4250
newbalance = self.nodes[0].getbalance()
43-
assert(balance - newbalance < Decimal("0.001")) #no more than fees lost
51+
assert balance - newbalance < Decimal("0.001") #no more than fees lost
4452
balance = newbalance
4553

4654
# Disconnect nodes so node0's transactions don't get into node1's mempool
@@ -51,10 +59,10 @@ def run_test(self):
5159
nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txB, 1)["vout"]) if vout["value"] == Decimal("10"))
5260
nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txC, 1)["vout"]) if vout["value"] == Decimal("10"))
5361

54-
inputs =[]
62+
inputs = []
5563
# spend 10btc outputs from txA and txB
56-
inputs.append({"txid":txA, "vout":nA})
57-
inputs.append({"txid":txB, "vout":nB})
64+
inputs.append({"txid": txA, "vout": nA})
65+
inputs.append({"txid": txB, "vout": nB})
5866
outputs = {}
5967

6068
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
@@ -67,17 +75,17 @@ def run_test(self):
6775

6876
#Create a child tx spending AB1 and C
6977
inputs = []
70-
inputs.append({"txid":txAB1, "vout":nAB})
71-
inputs.append({"txid":txC, "vout":nC})
78+
inputs.append({"txid": txAB1, "vout": nAB})
79+
inputs.append({"txid": txC, "vout": nC})
7280
outputs = {}
7381
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
7482
signed2 = self.nodes[0].signrawtransactionwithwallet(self.nodes[0].createrawtransaction(inputs, outputs))
7583
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
7684

7785
# Create a child tx spending ABC2
7886
signed3_change = Decimal("24.999")
79-
inputs = [ {"txid":txABC2, "vout":0} ]
80-
outputs = { self.nodes[0].getnewaddress(): signed3_change }
87+
inputs = [{"txid": txABC2, "vout": 0}]
88+
outputs = {self.nodes[0].getnewaddress(): signed3_change}
8189
signed3 = self.nodes[0].signrawtransactionwithwallet(self.nodes[0].createrawtransaction(inputs, outputs))
8290
# note tx is never directly referenced, only abandoned as a child of the above
8391
self.nodes[0].sendrawtransaction(signed3["hex"])
@@ -105,7 +113,7 @@ def run_test(self):
105113
unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance()
106114
assert_equal(unconfbalance, newbalance)
107115
# Also shouldn't show up in listunspent
108-
assert(not txABC2 in [utxo["txid"] for utxo in self.nodes[0].listunspent(0)])
116+
assert not txABC2 in [utxo["txid"] for utxo in self.nodes[0].listunspent(0)]
109117
balance = newbalance
110118

111119
# Abandon original transaction and verify inputs are available again
@@ -145,8 +153,8 @@ def run_test(self):
145153

146154
# Create a double spend of AB1 by spending again from only A's 10 output
147155
# Mine double spend from node 1
148-
inputs =[]
149-
inputs.append({"txid":txA, "vout":nA})
156+
inputs = []
157+
inputs.append({"txid": txA, "vout": nA})
150158
outputs = {}
151159
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999")
152160
tx = self.nodes[0].createrawtransaction(inputs, outputs)
@@ -172,5 +180,6 @@ def run_test(self):
172180
self.log.info("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
173181
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
174182

183+
175184
if __name__ == '__main__':
176185
AbandonConflictTest().main()

test/functional/wallet_basic.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
wait_until,
2020
)
2121

22+
2223
class WalletTest(BitcoinTestFramework):
2324
def set_test_params(self):
2425
self.num_nodes = 4
@@ -237,7 +238,7 @@ def run_test(self):
237238
assert_equal(set(relayed), {txid1, txid2})
238239
sync_mempools(self.nodes)
239240

240-
assert(txid1 in self.nodes[3].getrawmempool())
241+
assert txid1 in self.nodes[3].getrawmempool()
241242

242243
# check if we can list zero value tx as available coins
243244
# 1. create raw_tx
@@ -264,7 +265,7 @@ def run_test(self):
264265
if uTx['txid'] == zero_value_txid:
265266
found = True
266267
assert_equal(uTx['amount'], Decimal('0'))
267-
assert(found)
268+
assert found
268269

269270
# do some -walletbroadcast tests
270271
self.stop_nodes()
@@ -341,7 +342,7 @@ def run_test(self):
341342
self.nodes[1].importaddress(address_to_import)
342343

343344
# 3. Validate that the imported address is watch-only on node1
344-
assert(self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"])
345+
assert self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"]
345346

346347
# 4. Check that the unspents after import are not spendable
347348
assert_array_result(self.nodes[1].listunspent(),
@@ -383,7 +384,7 @@ def run_test(self):
383384
addr = self.nodes[0].getnewaddress()
384385
self.nodes[0].setlabel(addr, label)
385386
assert_equal(self.nodes[0].getaddressinfo(addr)['label'], label)
386-
assert(label in self.nodes[0].listlabels())
387+
assert label in self.nodes[0].listlabels()
387388
self.nodes[0].rpc.ensure_ascii = True # restore to default
388389

389390
# maintenance tests
@@ -442,8 +443,8 @@ def run_test(self):
442443
# Without walletrejectlongchains, we will still generate a txid
443444
# The tx will be stored in the wallet but not accepted to the mempool
444445
extra_txid = self.nodes[0].sendtoaddress(sending_addr, Decimal('0.0001'))
445-
assert(extra_txid not in self.nodes[0].getrawmempool())
446-
assert(extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()])
446+
assert extra_txid not in self.nodes[0].getrawmempool()
447+
assert extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()]
447448
self.nodes[0].abandontransaction(extra_txid)
448449
total_txs = len(self.nodes[0].listtransactions("*", 99999))
449450

@@ -491,5 +492,6 @@ def run_test(self):
491492
self.nodes[0].setlabel(change, 'foobar')
492493
assert_equal(self.nodes[0].getaddressinfo(change)['ischange'], False)
493494

495+
494496
if __name__ == '__main__':
495497
WalletTest().main()

0 commit comments

Comments
 (0)