Deterministic NodeID:
- use_recoverable_channel is a user setting, available
only in standard wallets with a 'segwit' seed_type
- if enabled, 'lightning_xprv' is derived from seed
- otherwise, wallets use the existing 'lightning_privkey2'
Recoverable channels:
- channel recovery data is added funding tx using an OP_RETURN
- recovery data = 4 magic bytes + node id[0:16]
- recovery data is chacha20 encrypted using funding_address as nonce.
(this will allow to fund multiple channels in the same tx)
GUI:
- whether channels are recoverable is shown in wallet info dialog.
- if the wallet can have recoverable channels but has an old node_id,
users are told to close their channels and restore from seed
to have that feature.
This commit is contained in:
@@ -37,7 +37,8 @@ from .invoices import PR_TYPE_ONCHAIN, Invoice
|
||||
from .keystore import bip44_derivation
|
||||
from .transaction import Transaction, TxOutpoint, tx_from_any, PartialTransaction, PartialTxOutput
|
||||
from .logging import Logger
|
||||
from .lnutil import LOCAL, REMOTE, FeeUpdate, UpdateAddHtlc, LocalConfig, RemoteConfig, Keypair, OnlyPubkeyKeypair, RevocationStore, ChannelBackupStorage
|
||||
from .lnutil import LOCAL, REMOTE, FeeUpdate, UpdateAddHtlc, LocalConfig, RemoteConfig, Keypair, OnlyPubkeyKeypair, RevocationStore
|
||||
from .lnutil import ImportedChannelBackupStorage, OnchainChannelBackupStorage
|
||||
from .lnutil import ChannelConstraints, Outpoint, ShachainElement
|
||||
from .json_db import StoredDict, JsonDB, locked, modifier
|
||||
from .plugin import run_hook, plugin_loaders
|
||||
@@ -52,7 +53,7 @@ if TYPE_CHECKING:
|
||||
|
||||
OLD_SEED_VERSION = 4 # electrum versions < 2.0
|
||||
NEW_SEED_VERSION = 11 # electrum versions >= 2.0
|
||||
FINAL_SEED_VERSION = 38 # electrum >= 2.7 will set this to prevent
|
||||
FINAL_SEED_VERSION = 39 # electrum >= 2.7 will set this to prevent
|
||||
# old versions from overwriting new format
|
||||
|
||||
|
||||
@@ -186,6 +187,7 @@ class WalletDB(JsonDB):
|
||||
self._convert_version_36()
|
||||
self._convert_version_37()
|
||||
self._convert_version_38()
|
||||
self._convert_version_39()
|
||||
self.put('seed_version', FINAL_SEED_VERSION) # just to be sure
|
||||
|
||||
self._after_upgrade_tasks()
|
||||
@@ -778,6 +780,13 @@ class WalletDB(JsonDB):
|
||||
del d[key]
|
||||
self.data['seed_version'] = 38
|
||||
|
||||
def _convert_version_39(self):
|
||||
# this upgrade prevents initialization of lightning_privkey2 after lightning_xprv has been set
|
||||
if not self._is_upgrade_method_needed(38, 38):
|
||||
return
|
||||
self.data['imported_channel_backups'] = self.data.pop('channel_backups', {})
|
||||
self.data['seed_version'] = 39
|
||||
|
||||
def _convert_imported(self):
|
||||
if not self._is_upgrade_method_needed(0, 13):
|
||||
return
|
||||
@@ -1273,8 +1282,10 @@ class WalletDB(JsonDB):
|
||||
v = dict((k, FeeUpdate(**x)) for k, x in v.items())
|
||||
elif key == 'submarine_swaps':
|
||||
v = dict((k, SwapData(**x)) for k, x in v.items())
|
||||
elif key == 'channel_backups':
|
||||
v = dict((k, ChannelBackupStorage(**x)) for k, x in v.items())
|
||||
elif key == 'imported_channel_backups':
|
||||
v = dict((k, ImportedChannelBackupStorage(**x)) for k, x in v.items())
|
||||
elif key == 'onchain_channel_backups':
|
||||
v = dict((k, OnchainChannelBackupStorage(**x)) for k, x in v.items())
|
||||
elif key == 'tx_fees':
|
||||
v = dict((k, TxFeesValue(*x)) for k, x in v.items())
|
||||
elif key == 'prevouts_by_scripthash':
|
||||
|
||||
Reference in New Issue
Block a user