lint: fix issues from lint-python.sh

This commit is contained in:
Byron Hambly 2023-09-01 16:04:39 +02:00
parent 3dfd7a4e9f
commit b59e244da3
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
11 changed files with 13 additions and 16 deletions

View file

@ -24,7 +24,7 @@ from test_framework.messages import (
CTxOut,
MAX_BLOCK_WEIGHT,
SEQUENCE_FINAL,
uint256_from_compact,
# uint256_from_compact,
uint256_from_str,
)
from test_framework.p2p import P2PDataStore

View file

@ -4,7 +4,6 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RBF code."""
from copy import deepcopy
from decimal import Decimal
from test_framework.messages import (

View file

@ -101,7 +101,7 @@ from test_framework import util
from test_framework.key import generate_privkey, compute_xonly_pubkey, sign_schnorr, tweak_add_privkey, ECKey
from test_framework.address import (
hash160,
program_to_witness
# program_to_witness
)
from collections import OrderedDict, namedtuple
from enum import Enum
@ -1594,7 +1594,7 @@ class TaprootTest(BitcoinTestFramework):
# Require one negated and one non-negated in taps 5 and 6.
# assert taps[5].negflag != taps[6].negflag
cblks = [{leaf: get({**DEFAULT_CONTEXT, 'tap': taps[i], 'leaf': leaf}, 'controlblock') for leaf in taps[i].leaves} for i in range(7)]
# cblks = [{leaf: get({**DEFAULT_CONTEXT, 'tap': taps[i], 'leaf': leaf}, 'controlblock') for leaf in taps[i].leaves} for i in range(7)]
# Require one swapped and one unswapped in taps 3 and 4.
#assert (cblks[3]['0'][33:65] < cblks[3]['1'][33:65]) != (cblks[4]['0'][33:65] < cblks[4]['1'][33:65])
# Require one swapped and one unswapped in taps 5 and 6, both at the top and child level.

View file

@ -19,7 +19,6 @@ from test_framework.messages import (
CTransaction,
hash256,
)
from test_framework import util
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,

View file

@ -26,7 +26,6 @@ from test_framework.wallet import (
bulk_transaction,
create_child_with_parents,
make_chain,
DEFAULT_FEE,
)
class MempoolPackageLimitsTest(BitcoinTestFramework):

View file

@ -97,12 +97,13 @@ class MiningTest(BitcoinTestFramework):
# Check that default_witness_commitment is present.
assert 'default_witness_commitment' in tmpl
witness_commitment = tmpl['default_witness_commitment']
# witness_commitment = tmpl['default_witness_commitment']
# Check that default_witness_commitment is correct.
witness_root = CBlock.get_merkle_root([ser_uint256(0),
ser_uint256(txid)])
script = get_witness_script(witness_root, 0)
assert_equal(script.hex(), "6a24aa21a9ed3160175963f85aa4d48b96b0b1c16eb02693d2ee908f73391e78a73747722e72") # ELEMENTS: use `script` to placate linter
# ELEMENTS: The following assertion fails because
# (1) Elements appears to use a different merkle tree computation than Bitcoin here

View file

@ -88,7 +88,7 @@ class P2PIBDTxRelayTest(BitcoinTestFramework):
peer_txer = self.nodes[0].add_p2p_connection(P2PInterface())
# ELEMENTS FIXME:
# with self.nodes[0].assert_debug_log(expected_msgs=["was not accepted"]):
#peer_txer.send_and_ping(msg_tx(tx))
# peer_txer.send_and_ping(msg_tx(tx))
if __name__ == '__main__':
P2PIBDTxRelayTest().main()

View file

@ -21,7 +21,7 @@ from test_framework.blocktools import (
create_coinbase,
create_tx_with_script,
)
from test_framework.messages import COIN, CTxOutValue
from test_framework.messages import COIN
from test_framework.p2p import P2PDataStore
from test_framework.script import OP_TRUE
from test_framework.test_framework import BitcoinTestFramework

View file

@ -7,7 +7,7 @@
from decimal import Decimal
from itertools import product
from math import ceil
# from math import ceil
from test_framework.descriptors import descsum_create
from test_framework.key import ECKey
@ -1136,10 +1136,10 @@ class RawTransactionsTest(BitcoinTestFramework):
funded_tx3 = ext_fund.fundrawtransaction(raw_tx, {"solving_data": {"descriptors": [desc]}, "input_weights": [{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}]})
assert_equal(funded_tx2["fee"], funded_tx3["fee"])
# The feerate should be met
funded_tx4 = ext_fund.fundrawtransaction(raw_tx, {"input_weights": [{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}], "fee_rate": 10})
input_add_weight = high_input_weight - (41 * 4)
tx4_weight = ext_fund.decoderawtransaction(funded_tx4["hex"])["weight"] + input_add_weight
tx4_vsize = int(ceil(tx4_weight / 4))
# funded_tx4 = ext_fund.fundrawtransaction(raw_tx, {"input_weights": [{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}], "fee_rate": 10})
# input_add_weight = high_input_weight - (41 * 4)
# tx4_weight = ext_fund.decoderawtransaction(funded_tx4["hex"])["weight"] + input_add_weight
# tx4_vsize = int(ceil(tx4_weight / 4))
# assert_fee_amount(funded_tx4["fee"], tx4_vsize, Decimal(0.0001)) Fee is different in Elements
# Funding with weight at csuint boundaries should not cause problems

View file

@ -325,7 +325,6 @@ class RawTransactionsTest(BitcoinTestFramework):
self.sync_all()
inputs = [{"txid": txId, "vout": vout['n']}]
txout = self.nodes[0].gettxout(txId, vout['n'])
# Fee 10,000 satoshis, (1 - (10000 sat * 0.00000001 BTC/sat)) = 0.9999
outputs = [{self.nodes[0].getnewaddress(): Decimal("0.99990000")}, {"fee": 0.0001}]
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)

View file

@ -16,7 +16,7 @@ from test_framework.util import (
# assert_fee_amount,
assert_greater_than,
assert_raises_rpc_error,
count_bytes,
# count_bytes,
)
from test_framework.wallet_util import bytes_to_wif