diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -21,7 +21,7 @@ "type": "flake8", "include": "(\\.py$)", "flags": [ - "--select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,E901,E902,F401,F402,F403,F404,F405,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,W292,W293,W601,W602,W603,W604,W605,W606" + "--select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,E901,E902,F401,F402,F403,F404,F405,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W601,W602,W603,W604,W605,W606" ] }, "lint-format-strings": { diff --git a/test/functional/abc-mempool-accept-txn.py b/test/functional/abc-mempool-accept-txn.py --- a/test/functional/abc-mempool-accept-txn.py +++ b/test/functional/abc-mempool-accept-txn.py @@ -194,7 +194,6 @@ # shorthand for functions block = self.next_block - create_tx = self.create_tx # shorthand for variables node = self.nodes[0] diff --git a/test/functional/abc-minimaldata-activation.py b/test/functional/abc-minimaldata-activation.py --- a/test/functional/abc-minimaldata-activation.py +++ b/test/functional/abc-minimaldata-activation.py @@ -237,9 +237,6 @@ assert_equal(node.getblockchaininfo()[ 'mediantime'], GRAVITON_START_TIME - 1) - # save this tip for later - preupgrade_block = tip - self.log.info( "Mine the activation block itself, including a minimaldata violation at the last possible moment") tip = self.build_block(tip, [nonminimaltx_2]) @@ -249,9 +246,6 @@ assert_equal(node.getblockchaininfo()[ 'mediantime'], GRAVITON_START_TIME) - # save this tip for later - upgrade_block = tip - self.log.info( "Trying to mine a minimaldata violation, but we are just barely too late") self.check_for_ban_on_rejected_block( diff --git a/test/functional/abc-p2p-compactblocks.py b/test/functional/abc-p2p-compactblocks.py --- a/test/functional/abc-p2p-compactblocks.py +++ b/test/functional/abc-p2p-compactblocks.py @@ -169,7 +169,6 @@ # Make it the same format as transaction added for padding and save the size. # It's missing the padding output, so we add a constant to account for it. tx.rehash() - base_tx_size = len(tx.serialize()) + 18 # If a specific script is required, add it. if script != None: diff --git a/test/functional/abc-replay-protection.py b/test/functional/abc-replay-protection.py --- a/test/functional/abc-replay-protection.py +++ b/test/functional/abc-replay-protection.py @@ -298,7 +298,7 @@ assert(replay_tx1_id in set(node.getrawmempool())) # They also can also be mined - b5 = block(5) + block(5) update_block(5, replay_txns) yield accepted() diff --git a/test/functional/abc-segwit-recovery.py b/test/functional/abc-segwit-recovery.py --- a/test/functional/abc-segwit-recovery.py +++ b/test/functional/abc-segwit-recovery.py @@ -254,7 +254,7 @@ # Mine txfund, as it can't go into node_std mempool because it's # nonstandard. - b = block(5555) + block(5555) update_block(5555, [txfund, txfund_case0]) accepted(node_nonstd) @@ -285,7 +285,7 @@ # Blocks containing segwit spending txns are accepted in both nodes. block(5) - postforkblock = update_block(5, [txspend, txspend_case0]) + update_block(5, [txspend, txspend_case0]) accepted(node_nonstd) sync_blocks(self.nodes) diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -69,7 +69,6 @@ fundtx.rehash() # make spending tx - from_txid = fundtx.hash inputs = [{ "txid": fundtx.hash, "vout": 0 diff --git a/test/functional/feature_uacomment.py b/test/functional/feature_uacomment.py --- a/test/functional/feature_uacomment.py +++ b/test/functional/feature_uacomment.py @@ -18,7 +18,6 @@ def run_test(self): self.log.info("test multiple -uacomment") test_uacomment = self.nodes[0].getnetworkinfo()["subversion"] - subversion_len = len(test_uacomment) assert_equal(test_uacomment[-12:-2], "testnode-0") self.restart_node(0, ["-uacomment=foo"]) diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -162,7 +162,7 @@ req_start_time = time.time() try: http_response = self.__conn.getresponse() - except socket.timeout as e: + except socket.timeout: raise JSONRPCException({ 'code': -344, 'message': '{!r} RPC took longer than {} seconds. Consider ' diff --git a/test/functional/test_framework/blockstore.py b/test/functional/test_framework/blockstore.py --- a/test/functional/test_framework/blockstore.py +++ b/test/functional/test_framework/blockstore.py @@ -96,7 +96,7 @@ block.calc_sha256() try: self.blockDB[repr(block.sha256)] = bytes(block.serialize()) - except TypeError as e: + except TypeError: logger.exception("Unexpected error") self.currentBlock = block.sha256 self.headers_map[block.sha256] = CBlockHeader(block) @@ -157,7 +157,7 @@ tx.calc_sha256() try: self.txDB[repr(tx.sha256)] = bytes(tx.serialize()) - except TypeError as e: + except TypeError: logger.exception("Unexpected error") def get_transactions(self, inv): diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -145,18 +145,18 @@ self.setup_network() self.run_test() success = TestStatus.PASSED - except JSONRPCException as e: + except JSONRPCException: self.log.exception("JSONRPC error") except SkipTest as e: self.log.warning("Test Skipped: {}".format(e.message)) success = TestStatus.SKIPPED - except AssertionError as e: + except AssertionError: self.log.exception("Assertion failed") - except KeyError as e: + except KeyError: self.log.exception("Key error") - except Exception as e: + except Exception: self.log.exception("Unexpected exception caught during testing") - except KeyboardInterrupt as e: + except KeyboardInterrupt: self.log.warning("Exiting after keyboard interrupt") if success == TestStatus.FAILED and self.options.pdbonfailure: diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -436,7 +436,7 @@ handle_message(message, running_jobs) update_queue.task_done() - except Empty as e: + except Empty: if not on_ci(): print("Running jobs: {}".format(", ".join([j[1] for j in running_jobs])), end="\r") sys.stdout.flush() diff --git a/test/functional/wallet_abandonconflict.py b/test/functional/wallet_abandonconflict.py --- a/test/functional/wallet_abandonconflict.py +++ b/test/functional/wallet_abandonconflict.py @@ -12,7 +12,6 @@ """ from decimal import Decimal -from test_framework.messages import CTransaction, FromHex from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, @@ -34,8 +33,6 @@ def total_fees(*txids): total = 0 for txid in txids: - ctx = FromHex(CTransaction(), - self.nodes[0].getrawtransaction(txid)) total += self.nodes[0].calculate_fee_from_txid(txid) return satoshi_round(total) diff --git a/test/functional/wallet_hd.py b/test/functional/wallet_hd.py --- a/test/functional/wallet_hd.py +++ b/test/functional/wallet_hd.py @@ -18,8 +18,6 @@ self.extra_args = [[], ['-keypool=0']] def run_test(self): - tmpdir = self.options.tmpdir - # Make sure can't switch off usehd after wallet creation self.stop_node(1) self.nodes[1].assert_start_raises_init_error( diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -247,8 +247,7 @@ multi_sig_script = self.nodes[0].createmultisig( 2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']]) self.nodes[1].generate(100) - transactionid = self.nodes[1].sendtoaddress( - multi_sig_script['address'], 10.00) + self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) self.nodes[1].generate(1) timestamp = self.nodes[1].getblock( self.nodes[1].getbestblockhash())['mediantime'] @@ -281,8 +280,7 @@ multi_sig_script = self.nodes[0].createmultisig( 2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']]) self.nodes[1].generate(100) - transactionid = self.nodes[1].sendtoaddress( - multi_sig_script['address'], 10.00) + self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) self.nodes[1].generate(1) timestamp = self.nodes[1].getblock( self.nodes[1].getbestblockhash())['mediantime'] @@ -315,8 +313,7 @@ multi_sig_script = self.nodes[0].createmultisig( 2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']]) self.nodes[1].generate(100) - transactionid = self.nodes[1].sendtoaddress( - multi_sig_script['address'], 10.00) + self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) self.nodes[1].generate(1) timestamp = self.nodes[1].getblock( self.nodes[1].getbestblockhash())['mediantime'] @@ -351,8 +348,7 @@ multi_sig_script = self.nodes[0].createmultisig( 2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']]) self.nodes[1].generate(100) - transactionid = self.nodes[1].sendtoaddress( - multi_sig_script['address'], 10.00) + self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) self.nodes[1].generate(1) timestamp = self.nodes[1].getblock( self.nodes[1].getbestblockhash())['mediantime']