Skip to content

Commit

Permalink
SFT-4094: made a central function to get multisig policy, temporary k…
Browse files Browse the repository at this point in the history
…ey multisigs default to skip
  • Loading branch information
mjg-foundation committed Aug 21, 2024
1 parent 03c3737 commit eb91120
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ports/stm32/boards/Passport/modules/multisig_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def chain(self):

@classmethod
def get_trust_policy(cls):
from common import settings
return settings.get('multisig_policy', MUSIG_DEFAULT)
from utils import get_multisig_policy
return get_multisig_policy()

def serialize(self):
# return a JSON-able object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from pages import SettingPage
from public_constants import MUSIG_ASK, MUSIG_REQUIRE, MUSIG_SKIP, MUSIG_DEFAULT
from utils import get_multisig_policy

# Chooser for trust policy
ch = ['Ask to Import', 'Require Existing', 'Skip Verification']
Expand All @@ -24,4 +25,4 @@ def __init__(self, card_header=None, statusbar=None):
statusbar=statusbar,
setting_name='multisig_policy',
options=self.OPTIONS,
default_value=MUSIG_DEFAULT)
default_value=get_multisig_policy())
1 change: 1 addition & 0 deletions ports/stm32/boards/Passport/modules/public_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
MUSIG_ASK = const(1)
MUSIG_SKIP = const(2)
MUSIG_DEFAULT = MUSIG_ASK
MUSIG_TEMP_DEFAULT = MUSIG_SKIP

# Default Directories
DIR_BACKUPS = 'backups'
Expand Down
7 changes: 6 additions & 1 deletion ports/stm32/boards/Passport/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import lvgl as lv
from constants import NUM_BACKUP_CODE_SECTIONS, NUM_DIGITS_PER_BACKUP_CODE_SECTION
from public_constants import DIR_BACKUPS
from public_constants import DIR_BACKUPS, MUSIG_DEFAULT, MUSIG_TEMP_DEFAULT
from files import CardSlot
from styles.colors import DEFAULT_LARGE_ICON_COLOR
import ustruct
Expand Down Expand Up @@ -1569,4 +1569,9 @@ def insufficient_randomness(seed_words):
return False


def get_multisig_policy():
default = MUSIG_TEMP_DEFAULT if has_temporary_seed() else MUSIG_DEFAULT
return common.settings.get('multisig_policy', default)


# EOF

0 comments on commit eb91120

Please sign in to comment.