test nits

This commit is contained in:
scgbckbone 2026-05-22 14:50:07 +02:00 committed by doc-hex
parent 841e44335e
commit f5a1ef32c9
4 changed files with 17 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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