From ac4a0953060e34ddd8f4bd7aa28c719d8ed2c068 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Thu, 12 Jan 2017 17:39:50 +0100 Subject: [PATCH 1/2] Remove unused Python variables --- contrib/testgen/base58.py | 1 - contrib/testgen/gen_base58_test_vectors.py | 1 - qa/rpc-tests/forknotify.py | 2 +- qa/rpc-tests/p2p-segwit.py | 1 - qa/rpc-tests/receivedby.py | 3 +-- qa/rpc-tests/replace-by-fee.py | 1 - qa/rpc-tests/wallet.py | 1 - 7 files changed, 2 insertions(+), 8 deletions(-) diff --git a/contrib/testgen/base58.py b/contrib/testgen/base58.py index bb0aeaff05b..0d09692b36f 100644 --- a/contrib/testgen/base58.py +++ b/contrib/testgen/base58.py @@ -84,7 +84,6 @@ def b58decode_chk(v): result = b58decode(v) if result is None: return None - h3 = checksum(result[:-4]) if result[-4:] == checksum(result[:-4]): return result[:-4] else: diff --git a/contrib/testgen/gen_base58_test_vectors.py b/contrib/testgen/gen_base58_test_vectors.py index 7e475b7a36a..ac0701e6be6 100755 --- a/contrib/testgen/gen_base58_test_vectors.py +++ b/contrib/testgen/gen_base58_test_vectors.py @@ -45,7 +45,6 @@ def is_valid(v): result = b58decode_chk(v) if result is None: return False - valid = False for template in templates: prefix = str(bytearray(template[0])) suffix = str(bytearray(template[2])) diff --git a/qa/rpc-tests/forknotify.py b/qa/rpc-tests/forknotify.py index a1901aedab8..8b1403083f2 100755 --- a/qa/rpc-tests/forknotify.py +++ b/qa/rpc-tests/forknotify.py @@ -22,7 +22,7 @@ def __init__(self): def setup_network(self): self.nodes = [] self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt") - with open(self.alert_filename, 'w', encoding='utf8') as f: + with open(self.alert_filename, 'w', encoding='utf8'): pass # Just open then close to create zero-length file self.nodes.append(start_node(0, self.options.tmpdir, ["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""])) diff --git a/qa/rpc-tests/p2p-segwit.py b/qa/rpc-tests/p2p-segwit.py index 51adec5cae4..b0ff3beace6 100755 --- a/qa/rpc-tests/p2p-segwit.py +++ b/qa/rpc-tests/p2p-segwit.py @@ -951,7 +951,6 @@ def test_tx_relay_after_segwit_activation(self): tx.rehash() tx_hash = tx.sha256 - tx_value = tx.vout[0].nValue # Verify that unnecessary witnesses are rejected. self.test_node.announce_tx_and_wait_for_getdata(tx) diff --git a/qa/rpc-tests/receivedby.py b/qa/rpc-tests/receivedby.py index 4f17b661cb2..1b90b23330f 100755 --- a/qa/rpc-tests/receivedby.py +++ b/qa/rpc-tests/receivedby.py @@ -14,7 +14,6 @@ def get_sub_array_from_array(object_array, to_match): Finds and returns a sub array from an array of arrays. to_match should be a unique idetifier of a sub array ''' - num_matched = 0 for item in object_array: all_match = True for key,value in to_match.items(): @@ -104,7 +103,7 @@ def run_test(self): received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(),{"account":account}) if len(received_by_account_json) == 0: raise AssertionError("No accounts found in node") - balance_by_account = rec_by_accountArr = self.nodes[1].getreceivedbyaccount(account) + balance_by_account = self.nodes[1].getreceivedbyaccount(account) txid = self.nodes[0].sendtoaddress(addr, 0.1) self.sync_all() diff --git a/qa/rpc-tests/replace-by-fee.py b/qa/rpc-tests/replace-by-fee.py index 8aba06c60c6..2b29dfdd2bd 100755 --- a/qa/rpc-tests/replace-by-fee.py +++ b/qa/rpc-tests/replace-by-fee.py @@ -393,7 +393,6 @@ def test_too_many_replacements(self): utxo = make_utxo(self.nodes[0], initial_nValue) fee = int(0.0001*COIN) split_value = int((initial_nValue-fee)/(MAX_REPLACEMENT_LIMIT+1)) - actual_fee = initial_nValue - split_value*(MAX_REPLACEMENT_LIMIT+1) outputs = [] for i in range(MAX_REPLACEMENT_LIMIT+1): diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index f325ecb4a3a..c82e0adffa5 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -359,7 +359,6 @@ def run_test (self): rawtx = self.nodes[0].createrawtransaction([{"txid":singletxid, "vout":0}], {chain_addrs[0]:node0_balance/2-Decimal('0.01'), chain_addrs[1]:node0_balance/2-Decimal('0.01')}) signedtx = self.nodes[0].signrawtransaction(rawtx) singletxid = self.nodes[0].sendrawtransaction(signedtx["hex"]) - txids = [singletxid, singletxid] self.nodes[0].generate(1) # Make a long chain of unconfirmed payments without hitting mempool limit From 90fd29bd0dcbaf5d5c4ef9e69824297c35f0b88e Mon Sep 17 00:00:00 2001 From: practicalswift Date: Thu, 12 Jan 2017 21:50:18 +0100 Subject: [PATCH 2/2] Remove unused int64_t nSinceLastSeen --- src/addrman.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/addrman.cpp b/src/addrman.cpp index 662e931d252..d72042510a7 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -54,11 +54,8 @@ double CAddrInfo::GetChance(int64_t nNow) const { double fChance = 1.0; - int64_t nSinceLastSeen = nNow - nTime; int64_t nSinceLastTry = nNow - nLastTry; - if (nSinceLastSeen < 0) - nSinceLastSeen = 0; if (nSinceLastTry < 0) nSinceLastTry = 0;