mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
refactor: test: use _ variable for unused loop counters
substitutes "for x in range(N):" by "for _ in range(N):" indicates to the reader that a block is just repeated N times, and that the loop counter is not used in the body
This commit is contained in:
@ -125,7 +125,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
out_value = total_value // 10
|
||||
tx = CTransaction()
|
||||
tx.vin.append(CTxIn(COutPoint(block.vtx[0].sha256, 0), b''))
|
||||
for i in range(10):
|
||||
for _ in range(10):
|
||||
tx.vout.append(CTxOut(out_value, CScript([OP_TRUE])))
|
||||
tx.rehash()
|
||||
|
||||
@ -266,7 +266,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
address = node.getnewaddress()
|
||||
|
||||
segwit_tx_generated = False
|
||||
for i in range(num_transactions):
|
||||
for _ in range(num_transactions):
|
||||
txid = node.sendtoaddress(address, 0.1)
|
||||
hex_tx = node.gettransaction(txid)["hex"]
|
||||
tx = FromHex(CTransaction(), hex_tx)
|
||||
@ -418,7 +418,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
def build_block_with_transactions(self, node, utxo, num_transactions):
|
||||
block = self.build_block_on_tip(node)
|
||||
|
||||
for i in range(num_transactions):
|
||||
for _ in range(num_transactions):
|
||||
tx = CTransaction()
|
||||
tx.vin.append(CTxIn(COutPoint(utxo[0], utxo[1]), b''))
|
||||
tx.vout.append(CTxOut(utxo[2] - 1000, CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE])))
|
||||
@ -627,7 +627,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
# Test that requesting old compactblocks doesn't work.
|
||||
MAX_CMPCTBLOCK_DEPTH = 5
|
||||
new_blocks = []
|
||||
for i in range(MAX_CMPCTBLOCK_DEPTH + 1):
|
||||
for _ in range(MAX_CMPCTBLOCK_DEPTH + 1):
|
||||
test_node.clear_block_announcement()
|
||||
new_blocks.append(node.generate(1)[0])
|
||||
wait_until(test_node.received_block_announcement, timeout=30, lock=mininode_lock)
|
||||
|
Reference in New Issue
Block a user