Add test to sign 400 different PSBTs in one session
(cherry picked from commit ced5f068b1)
This commit is contained in:
parent
336bfbfe08
commit
84dda56746
@ -3,7 +3,6 @@
|
||||
# history.py - store some history about past transactions and/or outputs they involved
|
||||
#
|
||||
import gc, chains
|
||||
from utils import B2A
|
||||
from uhashlib import sha256
|
||||
from ustruct import pack, unpack
|
||||
from exceptions import IncorrectUTXOAmount
|
||||
|
||||
@ -430,7 +430,7 @@ class AuditLogger:
|
||||
|
||||
self.card = CardSlot().__enter__()
|
||||
|
||||
d = self.card.get_sd_root() + '/' + self.dirname
|
||||
d = self.card.get_sd_root() + '/' + self.dirname
|
||||
|
||||
# mkdir if needed
|
||||
try: uos.stat(d)
|
||||
@ -667,7 +667,6 @@ class HSMPolicy:
|
||||
def activate(self, new_file):
|
||||
# user approved the HSM activation, so apply it.
|
||||
from glob import dis
|
||||
from pincodes import pa
|
||||
|
||||
import glob
|
||||
assert not glob.hsm_active
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
# - set coldcard for testnet chain
|
||||
# - command line: py.test test_hsm.py --dev -s --ff
|
||||
# - no microSD card installed
|
||||
# For testing on a REAL Coldcard Mk4:
|
||||
# - create development firmware via `make dev`
|
||||
# - enable HSM commands in `Advanced/Tools -> Enable HSM -> Enable`
|
||||
#
|
||||
import pytest, time, itertools, base64, re, json, struct
|
||||
from collections import OrderedDict
|
||||
@ -757,6 +760,22 @@ def test_big_txn(num_in, num_out, dev, quick_start_hsm, hsm_status, is_simulator
|
||||
attempt_psbt(psbt)
|
||||
|
||||
|
||||
@pytest.mark.veryslow
|
||||
def test_multiple_signings(dev, quick_start_hsm, is_simulator,
|
||||
attempt_psbt, fake_txn, load_hsm_users,
|
||||
auth_user):
|
||||
# signs 400 different PSBTs in loop
|
||||
policy = DICT(warnings_ok=True, must_log=1, rules=[dict(users=['pw'])])
|
||||
load_hsm_users()
|
||||
quick_start_hsm(policy)
|
||||
|
||||
for count in range(400):
|
||||
psbt = fake_txn(2, 2, dev.master_xpub, change_outputs=[0])
|
||||
auth_user.psbt_hash = sha256(psbt).digest()
|
||||
auth_user("pw")
|
||||
attempt_psbt(psbt)
|
||||
|
||||
|
||||
def test_sign_msg_good(quick_start_hsm, change_hsm, attempt_msg_sign, addr_fmt=AF_CLASSIC):
|
||||
# message signing, but only at certain derivations
|
||||
permit = ['m/73', "m/*'", 'm/1p/3h/4/5/6/7' ]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user