From f5a1ef32c94ac76db168acda7b03042d86d5feef Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Fri, 22 May 2026 14:50:07 +0200 Subject: [PATCH] test nits --- testing/psbt.py | 4 +++- testing/test_hobble.py | 3 ++- testing/test_multisig.py | 18 ++++++++++-------- testing/txn.py | 2 ++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/testing/psbt.py b/testing/psbt.py index dbcf509d..1df16497 100644 --- a/testing/psbt.py +++ b/testing/psbt.py @@ -373,6 +373,9 @@ class BasicPSBT: return (self.version == 2) or (not self.txn) def parse(self, raw): + if isinstance(raw, str): + raw = raw.encode('ascii') + # auto-detect and decode Base64 and Hex. if raw[0:10].lower() == b'70736274ff': raw = a2b_hex(raw.strip()) @@ -580,4 +583,3 @@ def test_my_psbt(): assert chk == p # EOF - diff --git a/testing/test_hobble.py b/testing/test_hobble.py index cdcfd93a..e3e8acf3 100644 --- a/testing/test_hobble.py +++ b/testing/test_hobble.py @@ -28,6 +28,7 @@ from charcodes import KEY_QR def set_hobble(sim_exec, settings_set, settings_remove, goto_home): def doit(mode, enabled={}): # okeys, words, notes assert mode in { True, False, 2 } + assert not (set(enabled) - {'okeys', 'words', 'notes'}), enabled if mode: v = dict(en=True, pol={}) @@ -247,7 +248,7 @@ def test_h_seedvault(sv_empty, set_hobble, pick_menu_item, cap_menu, settings_se # clear keys from sv, should not be offered in menu, even if okeys set. settings_remove('seedvault') - set_hobble(True, {'okey'}) + set_hobble(True, {'okeys'}) m = cap_menu() assert 'Seed Vault' not in m diff --git a/testing/test_multisig.py b/testing/test_multisig.py index 244f3d6a..98a183e3 100644 --- a/testing/test_multisig.py +++ b/testing/test_multisig.py @@ -1297,6 +1297,8 @@ def fake_ms_txn(pytestconfig): psbt.txn_version = 2 psbt.input_count = num_ins psbt.output_count = num_outs + if lock_time: + psbt.fallback_locktime = lock_time txn = CTransaction() txn.nVersion = 2 @@ -1362,19 +1364,19 @@ def fake_ms_txn(pytestconfig): else: psbt.inputs[i].witness_utxo = supply.vout[-1].serialize() - supply.calc_sha256() - if psbt_v2: - psbt.inputs[i].previous_txid = supply.hash - psbt.inputs[i].prevout_idx = 0 - # TODO sequence - # TODO height timelock - # TODO time timelock - if lock_time and not i: seq = 0xfffffffd else: seq = 0xffffffff + supply.calc_sha256() + if psbt_v2: + psbt.inputs[i].previous_txid = supply.hash + psbt.inputs[i].prevout_idx = 0 + psbt.inputs[i].sequence = seq + # psbt.inputs[i].req_time_locktime = None + # psbt.inputs[i].req_height_locktime = None + spendable = CTxIn(COutPoint(supply.sha256, 0), nSequence=seq) txn.vin.append(spendable) diff --git a/testing/txn.py b/testing/txn.py index 1d8988d8..f800c86c 100644 --- a/testing/txn.py +++ b/testing/txn.py @@ -40,6 +40,8 @@ def fake_txn(dev, pytestconfig): psbt.txn_version = 2 psbt.input_count = num_ins psbt.output_count = num_outs + if lock_time: + psbt.fallback_locktime = lock_time txn = CTransaction() txn.nLockTime = lock_time