mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
qa: Style-only fixes in touched files
This commit is contained in:
parent
003a47f804
commit
fa2198328e
2 changed files with 29 additions and 18 deletions
|
@ -13,7 +13,15 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes, disconnect_nodes, sync_blocks, sync_mempools
|
from test_framework.util import (
|
||||||
|
assert_equal,
|
||||||
|
assert_raises_rpc_error,
|
||||||
|
connect_nodes,
|
||||||
|
disconnect_nodes,
|
||||||
|
sync_blocks,
|
||||||
|
sync_mempools,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AbandonConflictTest(BitcoinTestFramework):
|
class AbandonConflictTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
|
@ -40,7 +48,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
|
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
newbalance = self.nodes[0].getbalance()
|
newbalance = self.nodes[0].getbalance()
|
||||||
assert(balance - newbalance < Decimal("0.001")) #no more than fees lost
|
assert balance - newbalance < Decimal("0.001") #no more than fees lost
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Disconnect nodes so node0's transactions don't get into node1's mempool
|
# Disconnect nodes so node0's transactions don't get into node1's mempool
|
||||||
|
@ -105,7 +113,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance()
|
unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance()
|
||||||
assert_equal(unconfbalance, newbalance)
|
assert_equal(unconfbalance, newbalance)
|
||||||
# Also shouldn't show up in listunspent
|
# Also shouldn't show up in listunspent
|
||||||
assert(not txABC2 in [utxo["txid"] for utxo in self.nodes[0].listunspent(0)])
|
assert not txABC2 in [utxo["txid"] for utxo in self.nodes[0].listunspent(0)]
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Abandon original transaction and verify inputs are available again
|
# Abandon original transaction and verify inputs are available again
|
||||||
|
@ -172,5 +180,6 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
self.log.info("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
|
self.log.info("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
|
||||||
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
|
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
AbandonConflictTest().main()
|
AbandonConflictTest().main()
|
||||||
|
|
|
@ -19,6 +19,7 @@ from test_framework.util import (
|
||||||
wait_until,
|
wait_until,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class WalletTest(BitcoinTestFramework):
|
class WalletTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
|
@ -237,7 +238,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
assert_equal(set(relayed), {txid1, txid2})
|
assert_equal(set(relayed), {txid1, txid2})
|
||||||
sync_mempools(self.nodes)
|
sync_mempools(self.nodes)
|
||||||
|
|
||||||
assert(txid1 in self.nodes[3].getrawmempool())
|
assert txid1 in self.nodes[3].getrawmempool()
|
||||||
|
|
||||||
# check if we can list zero value tx as available coins
|
# check if we can list zero value tx as available coins
|
||||||
# 1. create raw_tx
|
# 1. create raw_tx
|
||||||
|
@ -264,7 +265,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
if uTx['txid'] == zero_value_txid:
|
if uTx['txid'] == zero_value_txid:
|
||||||
found = True
|
found = True
|
||||||
assert_equal(uTx['amount'], Decimal('0'))
|
assert_equal(uTx['amount'], Decimal('0'))
|
||||||
assert(found)
|
assert found
|
||||||
|
|
||||||
# do some -walletbroadcast tests
|
# do some -walletbroadcast tests
|
||||||
self.stop_nodes()
|
self.stop_nodes()
|
||||||
|
@ -341,7 +342,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
self.nodes[1].importaddress(address_to_import)
|
self.nodes[1].importaddress(address_to_import)
|
||||||
|
|
||||||
# 3. Validate that the imported address is watch-only on node1
|
# 3. Validate that the imported address is watch-only on node1
|
||||||
assert(self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"])
|
assert self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"]
|
||||||
|
|
||||||
# 4. Check that the unspents after import are not spendable
|
# 4. Check that the unspents after import are not spendable
|
||||||
assert_array_result(self.nodes[1].listunspent(),
|
assert_array_result(self.nodes[1].listunspent(),
|
||||||
|
@ -383,7 +384,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
addr = self.nodes[0].getnewaddress()
|
addr = self.nodes[0].getnewaddress()
|
||||||
self.nodes[0].setlabel(addr, label)
|
self.nodes[0].setlabel(addr, label)
|
||||||
assert_equal(self.nodes[0].getaddressinfo(addr)['label'], label)
|
assert_equal(self.nodes[0].getaddressinfo(addr)['label'], label)
|
||||||
assert(label in self.nodes[0].listlabels())
|
assert label in self.nodes[0].listlabels()
|
||||||
self.nodes[0].rpc.ensure_ascii = True # restore to default
|
self.nodes[0].rpc.ensure_ascii = True # restore to default
|
||||||
|
|
||||||
# maintenance tests
|
# maintenance tests
|
||||||
|
@ -442,8 +443,8 @@ class WalletTest(BitcoinTestFramework):
|
||||||
# Without walletrejectlongchains, we will still generate a txid
|
# Without walletrejectlongchains, we will still generate a txid
|
||||||
# The tx will be stored in the wallet but not accepted to the mempool
|
# The tx will be stored in the wallet but not accepted to the mempool
|
||||||
extra_txid = self.nodes[0].sendtoaddress(sending_addr, Decimal('0.0001'))
|
extra_txid = self.nodes[0].sendtoaddress(sending_addr, Decimal('0.0001'))
|
||||||
assert(extra_txid not in self.nodes[0].getrawmempool())
|
assert extra_txid not in self.nodes[0].getrawmempool()
|
||||||
assert(extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()])
|
assert extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()]
|
||||||
self.nodes[0].abandontransaction(extra_txid)
|
self.nodes[0].abandontransaction(extra_txid)
|
||||||
total_txs = len(self.nodes[0].listtransactions("*", 99999))
|
total_txs = len(self.nodes[0].listtransactions("*", 99999))
|
||||||
|
|
||||||
|
@ -491,5 +492,6 @@ class WalletTest(BitcoinTestFramework):
|
||||||
self.nodes[0].setlabel(change, 'foobar')
|
self.nodes[0].setlabel(change, 'foobar')
|
||||||
assert_equal(self.nodes[0].getaddressinfo(change)['ischange'], False)
|
assert_equal(self.nodes[0].getaddressinfo(change)['ischange'], False)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
WalletTest().main()
|
WalletTest().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue