numbers for humans

This commit is contained in:
Peter D. Gray 2024-10-24 12:11:01 -04:00 committed by scgbckbone
parent 12f62f95bc
commit e14fb64904
2 changed files with 10 additions and 8 deletions

View File

@ -260,12 +260,14 @@ class CCCConfigMenu(MenuSystem):
]
# look for wallets that are defined related to CCC feature, shortcut to them
count = 0
for ms in MultisigWallet.get_all():
if my_xfp in ms.xfp_paths:
items.append(MenuItem('%d/%d: %s' % (ms.M, ms.N, ms.name),
menu=make_ms_wallet_menu, arg=ms.storage_idx))
menu=make_ms_wallet_menu, arg=ms.storage_idx))
count += 1
items.append(MenuItem('↳ Build 2-of-N', f=self.build_2ofN, arg=len(items)>4))
items.append(MenuItem('↳ Build 2-of-N', f=self.build_2ofN, arg=count))
if CCCFeature.last_fail_reason:
# xxxxxxxxxxxxxxxx
@ -325,7 +327,7 @@ wallet, proceed to the multisig menu and remove related wallet entry.'''):
await export_multisig_xpubs(xfp=xfp, alt_secret=enc, skip_prompt=True)
async def build_2ofN(self, m, l, i):
num = i.arg
count = i.arg
# ask for a key B, assume A and C are defined => export MS config and import into self.
# - like the airgap setup, but assume A and C are this Coldcard
m = '''Builds simple 2-of-N multisig wallet, with this Coldcard's main secret (key A), \
@ -338,7 +340,7 @@ be ready to show it as a QR, before proceeding.'''
from multisig import create_ms_step1
# picks addr fmt, QR or not, gets at least one file, then...
await create_ms_step1(for_ccc=(CCCFeature.get_encoded_secret(), num))
await create_ms_step1(for_ccc=(CCCFeature.get_encoded_secret(), count))
# prompt for file, prompt for our acct number, unless already exported to this card?

View File

@ -1738,7 +1738,7 @@ async def ondevice_multisig_create(mode='p2wsh', addr_fmt=AF_P2WSH, is_qr=False,
return
if for_ccc:
secret, rand_name = for_ccc
secret, ccc_ms_count = for_ccc
# Always include 2 keys from CCC: own master (key A) and key C
# - force them to same derivation.
acct = await ux_enter_bip32_index('CCC Account Number:') or 0
@ -1793,9 +1793,9 @@ async def ondevice_multisig_create(mode='p2wsh', addr_fmt=AF_P2WSH, is_qr=False,
if for_ccc:
name = "Coldcard Co-sign" if version.has_qwerty else "CCC"
if rand_name:
# unique name (hopefully) for each CCC wallet
name += "x%X" % ngu.random.bytes(1)[0]
if ccc_ms_count:
# make name unique for each CCC wallet, but they can edit
name += " #%d" % (ccc_ms_count+1)
else:
name = 'CC-%d-of-%d' % (M, N)