guard regeneration of lightning address

This commit is contained in:
Omar
2026-08-09 16:01:42 +02:00
parent 43ae37df20
commit 931b6fb9d2
4 changed files with 14 additions and 1 deletions
@@ -442,6 +442,10 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
@action
BaseBitcoinAddressRecord generateNewAddress({String label = ''}) {
if (addressPageType is LightningAddressType) {
throw Exception("Lightning addresses cannot be rotated");
}
if (addressPageType == SilentPaymentsAddresType.p2sp && silentAddress != null) {
final currentSilentAddressIndex = silentAddresses
.where((addressRecord) => addressRecord.type != SegwitAddresType.p2tr)
+6
View File
@@ -317,6 +317,12 @@ class CWBitcoin extends Bitcoin {
return bitcoinWallet.walletAddresses.addressPageType == SilentPaymentsAddresType.p2sp;
}
@override
bool hasSelectedLightning(Object wallet) {
final bitcoinWallet = wallet as ElectrumWallet;
return bitcoinWallet.walletAddresses.addressPageType is LightningAddressType;
}
@override
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option) {
switch (option) {
@@ -614,7 +614,8 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
@computed
bool get isLightning =>
wallet.type == WalletType.bitcoin && selectedCurrency == CryptoCurrency.btcln;
wallet.type == WalletType.bitcoin &&
(selectedCurrency == CryptoCurrency.btcln || bitcoin!.hasSelectedLightning(wallet));
@computed
bool get isZCashTransparent {
+2
View File
@@ -149,6 +149,7 @@ import 'package:cw_bitcoin/bitcoin_amount_format.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_wallet_addresses.dart';
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
import 'package:cw_bitcoin/lightning/lightning_addres_type.dart';
import 'package:cw_bitcoin/lightning/pending_lightning_transaction.dart';
import 'package:cw_bitcoin/litecoin_wallet_service.dart';
import 'package:cw_bitcoin/litecoin_wallet.dart';
@@ -245,6 +246,7 @@ abstract class Bitcoin {
ReceivePageOption getLitecoinMwebReceivePageOption();
bool isPayjoinAvailable(Object wallet);
bool hasSelectedSilentPayments(Object wallet);
bool hasSelectedLightning(Object wallet);
bool isBitcoinReceivePageOption(ReceivePageOption option);
BitcoinAddressType getOptionToType(ReceivePageOption option);
bool hasTaprootInput(PendingTransaction pendingTransaction);