mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
scripted-diff: Use generate* from TestFramework
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i \ 's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \ $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf') -END VERIFY SCRIPT-
This commit is contained in:
@ -70,10 +70,10 @@ class WalletTest(BitcoinTestFramework):
|
||||
assert 'watchonly' not in self.nodes[1].getbalances()
|
||||
|
||||
self.log.info("Mining blocks ...")
|
||||
self.nodes[0].generate(1)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(1)
|
||||
self.nodes[1].generatetoaddress(COINBASE_MATURITY + 1, ADDRESS_WATCHONLY)
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.generatetoaddress(self.nodes[1], COINBASE_MATURITY + 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
if not self.options.descriptors:
|
||||
@ -196,7 +196,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.log.info("Test getbalance and getbalances.mine.untrusted_pending with conflicted unconfirmed inputs")
|
||||
test_balances(fee_node_1=Decimal('0.02'))
|
||||
|
||||
self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY)
|
||||
self.generatetoaddress(self.nodes[1], 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
# balances are correct after the transactions are confirmed
|
||||
@ -210,7 +210,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
# Send total balance away from node 1
|
||||
txs = create_transactions(self.nodes[1], self.nodes[0].getnewaddress(), Decimal('29.97'), [Decimal('0.01')])
|
||||
self.nodes[1].sendrawtransaction(txs[0]['hex'])
|
||||
self.nodes[1].generatetoaddress(2, ADDRESS_WATCHONLY)
|
||||
self.generatetoaddress(self.nodes[1], 2, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
# getbalance with a minconf incorrectly excludes coins that have been spent more recently than the minconf blocks ago
|
||||
@ -257,7 +257,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.nodes[1].sendrawtransaction(hexstring=tx_replace, maxfeerate=0)
|
||||
|
||||
# Now confirm tx_replace
|
||||
block_reorg = self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY)[0]
|
||||
block_reorg = self.generatetoaddress(self.nodes[1], 1, ADDRESS_WATCHONLY)[0]
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(minconf=0), total_amount)
|
||||
|
||||
@ -265,7 +265,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.nodes[0].invalidateblock(block_reorg)
|
||||
self.nodes[1].invalidateblock(block_reorg)
|
||||
assert_equal(self.nodes[0].getbalance(minconf=0), 0) # wallet txs not in the mempool are untrusted
|
||||
self.nodes[0].generatetoaddress(1, ADDRESS_WATCHONLY)
|
||||
self.generatetoaddress(self.nodes[0], 1, ADDRESS_WATCHONLY)
|
||||
assert_equal(self.nodes[0].getbalance(minconf=0), 0) # wallet txs not in the mempool are untrusted
|
||||
|
||||
# Now confirm tx_orig
|
||||
@ -273,7 +273,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.connect_nodes(0, 1)
|
||||
self.sync_blocks()
|
||||
self.nodes[1].sendrawtransaction(tx_orig)
|
||||
self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY)
|
||||
self.generatetoaddress(self.nodes[1], 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(minconf=0), total_amount + 1) # The reorg recovered our fee of 1 coin
|
||||
|
||||
|
Reference in New Issue
Block a user