diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py --- a/test/functional/interface_bitcoin_cli.py +++ b/test/functional/interface_bitcoin_cli.py @@ -5,6 +5,7 @@ """Test bitcoin-cli""" from decimal import Decimal + from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -5,14 +5,15 @@ """Test the REST API.""" import binascii +import http.client +import json +import urllib.parse from decimal import Decimal from enum import Enum -import http.client from io import BytesIO -import json from struct import pack, unpack -import urllib.parse +from test_framework.messages import BLOCK_HEADER_SIZE from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, @@ -21,8 +22,6 @@ hex_str_to_bytes, ) -from test_framework.messages import BLOCK_HEADER_SIZE - class ReqType(Enum): JSON = 1 diff --git a/test/functional/interface_rpc.py b/test/functional/interface_rpc.py --- a/test/functional/interface_rpc.py +++ b/test/functional/interface_rpc.py @@ -5,6 +5,7 @@ """Tests some generic aspects of the RPC interface.""" import os + from test_framework.authproxy import JSONRPCException from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, assert_greater_than_or_equal diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -5,15 +5,12 @@ """Test the ZMQ notification interface.""" import struct from io import BytesIO +from time import sleep from test_framework.address import ADDRESS_ECREG_UNSPENDABLE -from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import CTransaction, hash256 -from test_framework.util import ( - assert_equal, - connect_nodes, -) -from time import sleep +from test_framework.test_framework import BitcoinTestFramework +from test_framework.util import assert_equal, connect_nodes def hash256_reversed(byte_str): diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -4,21 +4,18 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mempool acceptance of raw transactions.""" -from test_framework.test_framework import BitcoinTestFramework from test_framework.key import ECKey from test_framework.messages import ( + MAX_BLOCK_BASE_SIZE, + MAX_MONEY, XEC, COutPoint, CTransaction, CTxOut, FromHex, - MAX_BLOCK_BASE_SIZE, ToHex, - MAX_MONEY, ) from test_framework.script import ( - hash160, - CScript, OP_0, OP_2, OP_3, @@ -26,11 +23,11 @@ OP_EQUAL, OP_HASH160, OP_RETURN, + CScript, + hash160, ) -from test_framework.util import ( - assert_equal, - assert_raises_rpc_error, -) +from test_framework.test_framework import BitcoinTestFramework +from test_framework.util import assert_equal, assert_raises_rpc_error class MempoolAcceptanceTest(BitcoinTestFramework): diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -35,9 +35,9 @@ node1 can't write to disk. """ -from decimal import Decimal import os import time +from decimal import Decimal from test_framework.p2p import P2PTxInvStore from test_framework.test_framework import BitcoinTestFramework diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -8,8 +8,8 @@ that spend (directly or indirectly) coinbase transactions. """ -from test_framework.test_framework import BitcoinTestFramework from test_framework.blocktools import create_raw_transaction +from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, assert_raises_rpc_error diff --git a/test/functional/mempool_resurrect.py b/test/functional/mempool_resurrect.py --- a/test/functional/mempool_resurrect.py +++ b/test/functional/mempool_resurrect.py @@ -4,8 +4,8 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test resurrection of mined transactions when the blockchain is re-organized.""" -from test_framework.test_framework import BitcoinTestFramework from test_framework.blocktools import create_raw_transaction +from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py --- a/test/functional/mempool_spend_coinbase.py +++ b/test/functional/mempool_spend_coinbase.py @@ -12,8 +12,8 @@ but less mature coinbase spends are NOT. """ -from test_framework.test_framework import BitcoinTestFramework from test_framework.blocktools import create_raw_transaction +from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, assert_raises_rpc_error diff --git a/test/functional/mempool_unbroadcast.py b/test/functional/mempool_unbroadcast.py --- a/test/functional/mempool_unbroadcast.py +++ b/test/functional/mempool_unbroadcast.py @@ -10,11 +10,7 @@ from test_framework.blocktools import create_confirmed_utxos from test_framework.p2p import P2PTxInvStore from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import ( - assert_equal, - connect_nodes, - disconnect_nodes, -) +from test_framework.util import assert_equal, connect_nodes, disconnect_nodes # 15 minutes in seconds MAX_INITIAL_BROADCAST_DELAY = 15 * 60 diff --git a/test/functional/mempool_updatefromblock.py b/test/functional/mempool_updatefromblock.py --- a/test/functional/mempool_updatefromblock.py +++ b/test/functional/mempool_updatefromblock.py @@ -8,8 +8,8 @@ when transactions have been re-added from a disconnected block to the mempool. """ import time - from decimal import Decimal + from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py --- a/test/functional/mining_basic.py +++ b/test/functional/mining_basic.py @@ -11,18 +11,9 @@ import copy from decimal import Decimal -from test_framework.blocktools import ( - create_coinbase, - TIME_GENESIS_BLOCK, -) -from test_framework.messages import ( - CBlock, - CBlockHeader, - BLOCK_HEADER_SIZE, -) -from test_framework.p2p import ( - P2PDataStore, -) +from test_framework.blocktools import TIME_GENESIS_BLOCK, create_coinbase +from test_framework.messages import BLOCK_HEADER_SIZE, CBlock, CBlockHeader +from test_framework.p2p import P2PDataStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, diff --git a/test/functional/mining_getblocktemplate_longpoll.py b/test/functional/mining_getblocktemplate_longpoll.py --- a/test/functional/mining_getblocktemplate_longpoll.py +++ b/test/functional/mining_getblocktemplate_longpoll.py @@ -4,8 +4,8 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test longpolling with getblocktemplate.""" -from decimal import Decimal import threading +from decimal import Decimal from test_framework.test_framework import BitcoinTestFramework from test_framework.util import get_rpc_proxy, random_transaction diff --git a/test/functional/mining_prioritisetransaction.py b/test/functional/mining_prioritisetransaction.py --- a/test/functional/mining_prioritisetransaction.py +++ b/test/functional/mining_prioritisetransaction.py @@ -10,6 +10,7 @@ create_confirmed_utxos, send_big_transactions, ) + # FIXME: review how this test needs to be adapted w.r.t _LEGACY_MAX_BLOCK_SIZE from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE from test_framework.messages import COIN