mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 18:51:15 +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:
@ -67,10 +67,10 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
index_hash_options = ['none', 'muhash']
|
||||
|
||||
# Generate a normal transaction and mine it
|
||||
node.generate(COINBASE_MATURITY + 1)
|
||||
self.generate(node, COINBASE_MATURITY + 1)
|
||||
address = self.nodes[0].get_deterministic_priv_key().address
|
||||
node.sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
|
||||
node.generate(1)
|
||||
self.generate(node, 1)
|
||||
|
||||
self.sync_blocks(timeout=120)
|
||||
|
||||
@ -92,7 +92,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
self.log.info("Test that gettxoutsetinfo() can get fetch data on specific heights with index")
|
||||
|
||||
# Generate a new tip
|
||||
node.generate(5)
|
||||
self.generate(node, 5)
|
||||
|
||||
for hash_option in index_hash_options:
|
||||
# Fetch old stats by height
|
||||
@ -169,7 +169,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendrawtransaction(tx2_hex)
|
||||
|
||||
# Include both txs in a block
|
||||
self.nodes[0].generate(1)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
for hash_option in index_hash_options:
|
||||
@ -228,7 +228,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
res9 = index_node.gettxoutsetinfo('muhash')
|
||||
assert_equal(res8, res9)
|
||||
|
||||
index_node.generate(1)
|
||||
self.generate(index_node, 1)
|
||||
res10 = index_node.gettxoutsetinfo('muhash')
|
||||
assert(res8['txouts'] < res10['txouts'])
|
||||
|
||||
@ -247,14 +247,14 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
|
||||
# Generate two block, let the index catch up, then invalidate the blocks
|
||||
index_node = self.nodes[1]
|
||||
reorg_blocks = index_node.generatetoaddress(2, index_node.getnewaddress())
|
||||
reorg_blocks = self.generatetoaddress(index_node, 2, index_node.getnewaddress())
|
||||
reorg_block = reorg_blocks[1]
|
||||
res_invalid = index_node.gettxoutsetinfo('muhash')
|
||||
index_node.invalidateblock(reorg_blocks[0])
|
||||
assert_equal(index_node.gettxoutsetinfo('muhash')['height'], 110)
|
||||
|
||||
# Add two new blocks
|
||||
block = index_node.generate(2)[1]
|
||||
block = self.generate(index_node, 2)[1]
|
||||
res = index_node.gettxoutsetinfo(hash_type='muhash', hash_or_height=None, use_index=False)
|
||||
|
||||
# Test that the result of the reorged block is not returned for its old block height
|
||||
@ -270,7 +270,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
|
||||
# Add another block, so we don't depend on reconsiderblock remembering which
|
||||
# blocks were touched by invalidateblock
|
||||
index_node.generate(1)
|
||||
self.generate(index_node, 1)
|
||||
self.sync_all()
|
||||
|
||||
# Ensure that removing and re-adding blocks yields consistent results
|
||||
|
Reference in New Issue
Block a user