tests: run black
This commit is contained in:
parent
f14c3a7f75
commit
deb75884bf
@ -93,7 +93,9 @@ def sign_psbt_taproot(psbt, hds):
|
||||
psbt_str = psbt.to_base64()
|
||||
for hd in hds:
|
||||
xprv = hd.get_xpriv()
|
||||
proc = subprocess.run([bin_path, psbt_str, xprv], capture_output=True, check=True)
|
||||
proc = subprocess.run(
|
||||
[bin_path, psbt_str, xprv], capture_output=True, check=True
|
||||
)
|
||||
psbt_str = proc.stdout.decode("utf-8")
|
||||
|
||||
return PSBT.from_base64(psbt_str)
|
||||
|
||||
@ -24,7 +24,9 @@ DEFAULT_BITCOIND_PATH = "bitcoind"
|
||||
BITCOIND_PATH = os.getenv("BITCOIND_PATH", DEFAULT_BITCOIND_PATH)
|
||||
OLD_LIANAD_PATH = os.getenv("OLD_LIANAD_PATH", None)
|
||||
IS_NOT_BITCOIND_24 = bool(int(os.getenv("IS_NOT_BITCOIND_24", True)))
|
||||
USE_TAPROOT = bool(int(os.getenv("USE_TAPROOT", False))) # TODO: switch to True in a couple releases.
|
||||
USE_TAPROOT = bool(
|
||||
int(os.getenv("USE_TAPROOT", False))
|
||||
) # TODO: switch to True in a couple releases.
|
||||
|
||||
|
||||
COIN = 10**8
|
||||
|
||||
@ -250,12 +250,15 @@ def test_coinbase_deposit(lianad, bitcoind):
|
||||
assert coin["is_change"]
|
||||
bitcoind.generate_block(100)
|
||||
wait_for_sync()
|
||||
coin = next(c for c in lianad.rpc.listcoins()["coins"] if c["outpoint"] == coin["outpoint"])
|
||||
coin = next(
|
||||
c for c in lianad.rpc.listcoins()["coins"] if c["outpoint"] == coin["outpoint"]
|
||||
)
|
||||
assert not coin["is_immature"] and coin["block_height"] is not None
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
OLD_LIANAD_PATH is None or USE_TAPROOT, reason="Need the old lianad binary to create the datadir."
|
||||
OLD_LIANAD_PATH is None or USE_TAPROOT,
|
||||
reason="Need the old lianad binary to create the datadir.",
|
||||
)
|
||||
def test_migration(lianad_multisig, bitcoind):
|
||||
"""Test we can start a newer lianad on a datadir created by an older lianad."""
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
from fixtures import *
|
||||
from test_framework.serializations import PSBT, uint256_from_str
|
||||
from test_framework.utils import sign_and_broadcast_psbt, wait_for, COIN, RpcError, USE_TAPROOT
|
||||
from test_framework.utils import (
|
||||
sign_and_broadcast_psbt,
|
||||
wait_for,
|
||||
COIN,
|
||||
RpcError,
|
||||
USE_TAPROOT,
|
||||
)
|
||||
|
||||
|
||||
def test_spend_change(lianad, bitcoind):
|
||||
@ -334,7 +340,9 @@ def test_coin_selection(lianad, bitcoind):
|
||||
bytes.fromhex(spend_txid_1)[::-1]
|
||||
)
|
||||
anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"]
|
||||
anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN)
|
||||
anc_fees = int(
|
||||
bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN
|
||||
)
|
||||
additional_fee = additional_fees(anc_vsize, anc_fees, feerate)
|
||||
assert len(spend_res_2["warnings"]) == 1
|
||||
assert (
|
||||
@ -352,7 +360,9 @@ def test_coin_selection(lianad, bitcoind):
|
||||
bytes.fromhex(spend_txid_1)[::-1]
|
||||
)
|
||||
anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"]
|
||||
anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN)
|
||||
anc_fees = int(
|
||||
bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN
|
||||
)
|
||||
additional_fee = additional_fees(anc_vsize, anc_fees, feerate)
|
||||
assert len(spend_res_2["warnings"]) == 1
|
||||
assert (
|
||||
@ -398,8 +408,12 @@ def test_coin_selection(lianad, bitcoind):
|
||||
anc_vsize = bitcoind.rpc.getmempoolentry(deposit_2)["ancestorsize"]
|
||||
anc_fees = int(bitcoind.rpc.getmempoolentry(deposit_2)["fees"]["ancestor"] * COIN)
|
||||
prev_anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"]
|
||||
prev_anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN)
|
||||
additional_fee = additional_fees(anc_vsize, anc_fees, feerate) + additional_fees(prev_anc_vsize, prev_anc_fees, feerate)
|
||||
prev_anc_fees = int(
|
||||
bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN
|
||||
)
|
||||
additional_fee = additional_fees(anc_vsize, anc_fees, feerate) + additional_fees(
|
||||
prev_anc_vsize, prev_anc_fees, feerate
|
||||
)
|
||||
assert len(spend_res_3["warnings"]) == 1
|
||||
assert (
|
||||
spend_res_3["warnings"][0]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user