fix: resolve UnknownBaseUnit crash in QML btcAmountRegex for non-BTC chains
Replace hardcoded \"BTC\" with get_base_units_list()[0] so the top-level unit name is resolved dynamically from chain constants (e.g. \"BTCP\" for BitcoinPurple), preventing the UnknownBaseUnit exception on receive screen.
This commit is contained in:
@@ -7,7 +7,7 @@ from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QRegularEx
|
||||
from electrum.bitcoin import TOTAL_COIN_SUPPLY_LIMIT_IN_BTC
|
||||
from electrum.i18n import set_language, get_gui_lang_names
|
||||
from electrum.logging import get_logger
|
||||
from electrum.util import base_unit_name_to_decimal_point
|
||||
from electrum.util import base_unit_name_to_decimal_point, get_base_units_list
|
||||
from electrum.gui import messages
|
||||
|
||||
from .qetypes import QEAmount
|
||||
@@ -106,7 +106,7 @@ class QEConfig(AuthMixin, QObject):
|
||||
decimal_point = base_unit_name_to_decimal_point(self.config.get_base_unit())
|
||||
max_digits_before_dp = (
|
||||
len(str(TOTAL_COIN_SUPPLY_LIMIT_IN_BTC))
|
||||
+ (base_unit_name_to_decimal_point("BTC") - decimal_point))
|
||||
+ (base_unit_name_to_decimal_point(get_base_units_list()[0]) - decimal_point))
|
||||
exp = '^[0-9]{0,%d}' % max_digits_before_dp
|
||||
decimal_point += extra_precision
|
||||
if decimal_point > 0:
|
||||
|
||||
Reference in New Issue
Block a user