Skip to content

Commit 359d067

Browse files
committed
[tests] Fix flake8 warnings in invalidtxrequest
1 parent c32cf9f commit 359d067

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

test/functional/p2p_invalid_tx.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test node responses to invalid transactions.
66
7-
In this test we connect to one node over p2p, and test tx requests.
8-
"""
9-
10-
from test_framework.test_framework import ComparisonTestFramework
11-
from test_framework.comptool import TestManager, TestInstance, RejectResult
12-
from test_framework.blocktools import *
7+
In this test we connect to one node over p2p, and test tx requests."""
138
import time
149

10+
from test_framework.blocktools import create_block, create_coinbase, create_transaction
11+
from test_framework.comptool import RejectResult, TestInstance, TestManager
12+
from test_framework.messages import COIN
13+
from test_framework.mininode import network_thread_start
14+
from test_framework.test_framework import ComparisonTestFramework
1515

16-
17-
# Use the ComparisonTestFramework with 1 node: only use --testbinary.
1816
class InvalidTxRequestTest(ComparisonTestFramework):
1917

20-
''' Can either run this test as 1 node with expected answers, or two and compare them.
21-
Change the "outcome" variable from each TestInstance object to only do the comparison. '''
2218
def set_test_params(self):
2319
self.num_nodes = 1
2420
self.setup_clean_chain = True
@@ -32,13 +28,10 @@ def run_test(self):
3228
test.run()
3329

3430
def get_tests(self):
35-
if self.tip is None:
36-
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
37-
self.block_time = int(time.time())+1
31+
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
32+
self.block_time = int(time.time()) + 1
3833

39-
'''
40-
Create a new block with an anyone-can-spend coinbase
41-
'''
34+
self.log.info("Create a new block with an anyone-can-spend coinbase.")
4235
height = 1
4336
block = create_block(self.tip, create_coinbase(height), self.block_time)
4437
self.block_time += 1
@@ -49,9 +42,7 @@ def get_tests(self):
4942
height += 1
5043
yield TestInstance([[block, True]])
5144

52-
'''
53-
Now we need that block to mature so we can spend the coinbase.
54-
'''
45+
self.log.info("Mature the block.")
5546
test = TestInstance(sync_every_block=False)
5647
for i in range(100):
5748
block = create_block(self.tip, create_coinbase(height), self.block_time)

0 commit comments

Comments
 (0)