From 718c0ca354eb00a96b1bc2dd3edf595e7cf9a096 Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Mon, 13 Jan 2025 11:12:27 +0100 Subject: [PATCH] testnet4 (cherry picked from commit 92a776cfc30d72a1613f7bcf6385bf8ebf56ad5a) --- releases/Next-ChangeLog.md | 1 + shared/address_explorer.py | 3 +-- shared/chains.py | 10 +++------- shared/export.py | 11 ++--------- shared/flow.py | 2 +- shared/ownership.py | 3 +-- 6 files changed, 9 insertions(+), 21 deletions(-) diff --git a/releases/Next-ChangeLog.md b/releases/Next-ChangeLog.md index 236632b1..5c9d91ba 100644 --- a/releases/Next-ChangeLog.md +++ b/releases/Next-ChangeLog.md @@ -13,6 +13,7 @@ This lists the new changes that have not yet been published in a normal release. - Bugfix: Prevent yikes in ownership search - Change: Do not allow to purge settings of current active tmp seed when deleting it from Seed Vault - Change: Do not include sighash in PSBT input data, if sighash value is SIGHASH_ALL +- Change: Testnet3 -> Testnet4 (all parameters are the same) # Mk4 Specific Changes diff --git a/shared/address_explorer.py b/shared/address_explorer.py index 2e765839..5ce083ed 100644 --- a/shared/address_explorer.py +++ b/shared/address_explorer.py @@ -169,8 +169,7 @@ class AddressListMenu(MenuSystem): # Create list of choices (address_index_0, path, addr_fmt) choices = [] for name, path, addr_fmt in chains.CommonDerivations: - if '{coin_type}' in path: - path = path.replace('{coin_type}', str(chain.b44_cointype)) + path = path.replace('{coin_type}', str(chain.b44_cointype)) if self.account_num != 0 and '{account}' not in path: # skip derivations that are not affected by account number diff --git a/shared/chains.py b/shared/chains.py index b76de121..a49a984f 100644 --- a/shared/chains.py +++ b/shared/chains.py @@ -51,8 +51,6 @@ def tapleaf_hash(script, leaf_version=TAPROOT_LEAF_TAPSCRIPT): class ChainsBase: curve = 'secp256k1' - menu_name = None # use 'name' if this isn't defined - core_name = None # name of chain's "core" p2p software # b44_cointype comes from # @@ -319,8 +317,7 @@ class ChainsBase: class BitcoinMain(ChainsBase): # see ctype = 'BTC' - name = 'Bitcoin' - core_name = 'Bitcoin Core' + name = 'Bitcoin Mainnet' slip132 = { AF_CLASSIC: Slip132Version(0x0488B21E, 0x0488ADE4, 'x'), @@ -340,9 +337,9 @@ class BitcoinMain(ChainsBase): b44_cointype = 0 class BitcoinTestnet(BitcoinMain): + # testnet4 (was testnet3 up until 2025 but all parameters are the same) ctype = 'XTN' - name = 'Bitcoin Testnet' - menu_name = 'Testnet: BTC' + name = 'Bitcoin Testnet 4' slip132 = { AF_CLASSIC: Slip132Version(0x043587cf, 0x04358394, 't'), @@ -365,7 +362,6 @@ class BitcoinTestnet(BitcoinMain): class BitcoinRegtest(BitcoinMain): ctype = 'XRT' name = 'Bitcoin Regtest' - menu_name = 'Regtest: BTC' slip132 = { AF_CLASSIC: Slip132Version(0x043587cf, 0x04358394, 't'), diff --git a/shared/export.py b/shared/export.py index 2a41477e..56d2afeb 100644 --- a/shared/export.py +++ b/shared/export.py @@ -73,14 +73,7 @@ be needed for different systems. sym=chain.ctype, ct=chain.b44_cointype, xfp=xfp)) for name, path, addr_fmt in chains.CommonDerivations: - - if '{coin_type}' in path: - path = path.replace('{coin_type}', str(chain.b44_cointype)) - - if '{' in name: - name = name.format(core_name=chain.core_name) - - show_slip132 = ('Core' not in name) + path = path.replace('{coin_type}', str(chain.b44_cointype)) yield ('''## For {name}: {path}\n\n'''.format(name=name, path=path)) yield ('''First %d receive addresses (account=0, change=0):\n\n''' % num_rx) @@ -103,7 +96,7 @@ be needed for different systems. node = sv.derive_path(hard_sub, register=False) yield ("%s => %s\n" % (hard_sub, chain.serialize_public(node))) - if show_slip132 and addr_fmt not in (AF_CLASSIC, AF_P2TR) and (addr_fmt in chain.slip132): + if addr_fmt not in (AF_CLASSIC, AF_P2TR) and (addr_fmt in chain.slip132): yield ("%s => %s ##SLIP-132##\n" % ( hard_sub, chain.serialize_public(node, addr_fmt))) diff --git a/shared/flow.py b/shared/flow.py index 4b1e9488..9e2dcd6e 100644 --- a/shared/flow.py +++ b/shared/flow.py @@ -308,7 +308,7 @@ If you disable sighash flag restrictions, and ignore the \ warnings, funds can be stolen by specially crafted PSBT or MitM. Keep blocked unless you intend to sign special transactions.'''), - ToggleMenuItem('Testnet Mode', 'chain', ['Bitcoin', 'Testnet3', 'Regtest'], + ToggleMenuItem('Testnet Mode', 'chain', ['Bitcoin', 'Testnet4', 'Regtest'], value_map=['BTC', 'XTN', 'XRT'], on_change=change_which_chain, story="Testnet must only be used by developers because \ diff --git a/shared/ownership.py b/shared/ownership.py index 5df3a836..4af51283 100644 --- a/shared/ownership.py +++ b/shared/ownership.py @@ -217,8 +217,7 @@ class OwnershipCache: addr_fmt = ch.possible_address_fmt(addr) if not addr_fmt: # might be valid address over on testnet vs mainnet - nm = ch.name if ch.ctype != 'BTC' else 'Bitcoin Mainnet' - raise UnknownAddressExplained('That address is not valid on ' + nm) + raise UnknownAddressExplained('That address is not valid on ' + ch.name) possibles = []