|
95 | 95 |
|
96 | 96 | if TYPE_CHECKING: |
97 | 97 | from .network import Network |
98 | | - from .wallet import Abstract_Wallet |
| 98 | + from .wallet import Abstract_Wallet, WalletWarning |
99 | 99 | from .channel_db import ChannelDB |
100 | 100 | from .simple_config import SimpleConfig |
101 | 101 |
|
@@ -1123,6 +1123,33 @@ def has_anchor_channels(self) -> bool: |
1123 | 1123 | return any(chan.has_anchors() and not chan.is_closed() |
1124 | 1124 | for chan in self.channels.values()) |
1125 | 1125 |
|
| 1126 | + def get_lightning_startup_warnings(self) -> Sequence['WalletWarning']: |
| 1127 | + from .wallet import WalletWarning |
| 1128 | + warnings = [] |
| 1129 | + if not self.has_deterministic_node_id() and self.has_anchor_channels(): |
| 1130 | + # backups exported before we started storing the payment_basepoint privkey |
| 1131 | + # (backup v3) cannot sweep the to_remote output of an anchor channel |
| 1132 | + warnings.append(WalletWarning( |
| 1133 | + key='ln_outdated_channel_backups', |
| 1134 | + title=_('Outdated channel backups'), |
| 1135 | + message=''.join([ |
| 1136 | + _("The Lightning channels of this wallet cannot be recovered from seed."), ' ', |
| 1137 | + _("Channel backups that were exported with an older version of Electrum " |
| 1138 | + "cannot be used to request a force close of these channels."), '\n\n', |
| 1139 | + _("Please export new channel backups and store them in a safe place."), |
| 1140 | + ]))) |
| 1141 | + if any(not cb.can_sweep_their_ctx_to_remote() for cb in self.channel_backups.values()): |
| 1142 | + warnings.append(WalletWarning( |
| 1143 | + key='ln_unusable_channel_backups', |
| 1144 | + title=_('Unusable channel backups'), |
| 1145 | + message=''.join([ |
| 1146 | + _("This wallet contains channel backups that cannot be used to request a force close, " |
| 1147 | + "because they were exported with an older version of Electrum."), ' ', |
| 1148 | + _("Please import new backups, exported by the wallet these channels belong to."), '\n\n', |
| 1149 | + _("If you have lost access to that wallet, please open an issue on GitHub."), |
| 1150 | + ]))) |
| 1151 | + return warnings |
| 1152 | + |
1126 | 1153 | @property |
1127 | 1154 | def features(self) -> 'LnFeatures': |
1128 | 1155 | return self.lnpeermgr.features |
|
0 commit comments