Cleanup use of MAX_TXN_LEN_MK4 vs. MAX_TXN_LEN
This commit is contained in:
parent
e150150d11
commit
e3ae6bcbdf
@ -16,7 +16,7 @@ from export import make_json_wallet, make_summary_file, make_descriptor_wallet_e
|
||||
from export import make_bitcoin_core_wallet, generate_wasabi_wallet, generate_generic_export
|
||||
from export import generate_unchained_export, generate_electrum_wallet
|
||||
from files import CardSlot, CardMissingError, needs_microsd
|
||||
from public_constants import AF_CLASSIC, AF_P2WPKH, AF_P2WPKH_P2SH, MAX_TXN_LEN_MK4
|
||||
from public_constants import AF_CLASSIC, AF_P2WPKH, AF_P2WPKH_P2SH
|
||||
from glob import settings
|
||||
from pincodes import pa
|
||||
from menu import start_chooser, MenuSystem, MenuItem
|
||||
@ -1511,7 +1511,7 @@ async def qr_share_file(_1, _2, item):
|
||||
|
||||
while 1:
|
||||
txid = None
|
||||
fn = await file_picker(min_size=10, max_size=MAX_TXN_LEN_MK4, taster=is_suitable)
|
||||
fn = await file_picker(min_size=10, max_size=MAX_TXN_LEN, taster=is_suitable)
|
||||
if not fn: return
|
||||
|
||||
basename = fn.split('/')[-1]
|
||||
|
||||
@ -6,6 +6,7 @@ import utime, uzlib, ngu
|
||||
from utils import problem_file_line
|
||||
from exceptions import QRDecodeExplained
|
||||
from ubinascii import unhexlify as a2b_hex
|
||||
from version import MAX_TXN_LEN
|
||||
|
||||
b32encode = ngu.codecs.b32_encode
|
||||
b32decode = ngu.codecs.b32_decode
|
||||
@ -328,14 +329,12 @@ class BBQrPsramStorage(BBQrStorage):
|
||||
def alloc_buf(self, upper_bound):
|
||||
# using first part of PSRAM
|
||||
|
||||
from public_constants import MAX_TXN_LEN_MK4
|
||||
|
||||
if upper_bound >= MAX_TXN_LEN_MK4:
|
||||
if upper_bound >= MAX_TXN_LEN:
|
||||
raise QRDecodeExplained("Too big")
|
||||
|
||||
# If data is compressed, write tmp (compressed) copy into top half of PSRAM
|
||||
# and we'll put final, decompressed copy at zero offset (later)
|
||||
self.psr_offset = MAX_TXN_LEN_MK4 if self.hdr.encoding == 'Z' else 0
|
||||
self.psr_offset = MAX_TXN_LEN if self.hdr.encoding == 'Z' else 0
|
||||
|
||||
self.buf = True
|
||||
|
||||
@ -394,7 +393,6 @@ class BBQrPsramStorage(BBQrStorage):
|
||||
from glob import PSRAM, dis
|
||||
from uzlib import DecompIO
|
||||
from io import BytesIO
|
||||
from public_constants import MAX_TXN_LEN_MK4
|
||||
|
||||
dis.fullscreen('Decompressing...')
|
||||
|
||||
@ -414,7 +412,7 @@ class BBQrPsramStorage(BBQrStorage):
|
||||
buf += here
|
||||
ln = len(buf) & ~3
|
||||
|
||||
if off+ln > MAX_TXN_LEN_MK4:
|
||||
if off+ln > MAX_TXN_LEN:
|
||||
# test with: `yes | dd bs=1000 count=2700 | bbqr make - | pbcopy`
|
||||
raise QRDecodeExplained("Too big")
|
||||
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
#
|
||||
# REMINDER: update simulator version of this file if API changes are made.
|
||||
#
|
||||
from public_constants import MAX_TXN_LEN, MAX_UPLOAD_LEN
|
||||
from public_constants import MAX_TXN_LEN_MK4 as MAX_TXN_LEN
|
||||
from public_constants import MAX_UPLOAD_LEN_MK4 as MAX_UPLOAD_LEN
|
||||
|
||||
def decode_firmware_header(hdr):
|
||||
from sigheader import FWH_PY_FORMAT
|
||||
@ -76,7 +77,6 @@ def probe_system():
|
||||
# run-once code to determine what hardware we are running on
|
||||
global hw_label, has_608, is_factory_mode, is_devmode, has_psram, is_edge
|
||||
global has_se2, mk_num, has_nfc, has_qr, num_sd_slots, has_qwerty, has_battery, supports_hsm
|
||||
global MAX_UPLOAD_LEN, MAX_TXN_LEN
|
||||
|
||||
from sigheader import RAM_BOOT_FLAGS, RBF_FACTORY_MODE
|
||||
import ckcc, callgate, machine
|
||||
@ -121,11 +121,6 @@ def probe_system():
|
||||
# what firmware signing key did we boot with? are we in dev mode?
|
||||
is_devmode = get_is_devmode()
|
||||
|
||||
# increase size limits for mk4
|
||||
from public_constants import MAX_TXN_LEN_MK4, MAX_UPLOAD_LEN_MK4
|
||||
MAX_UPLOAD_LEN = MAX_UPLOAD_LEN_MK4
|
||||
MAX_TXN_LEN = MAX_TXN_LEN_MK4
|
||||
|
||||
probe_system()
|
||||
|
||||
# EOF
|
||||
|
||||
Loading…
Reference in New Issue
Block a user