1
0

add static payment key

* in order to be able to sweep to_remote in an onchain backup scenario
  we need to retain the private key for the payment_basepoint
* to facilitate the above, we open a channel derived from a static
  secret (tied to the wallet seed), the static_payment_key combined with
the funding pubkey (multisig_key), which we can restore from the channel
closing transaction
This commit is contained in:
bitromortac
2021-09-22 11:12:38 +02:00
committed by ThomasV
parent 3951e07c53
commit 22f5ff0d0e
4 changed files with 43 additions and 8 deletions

View File

@@ -399,7 +399,6 @@ class AbstractChannel(Logger, ABC):
# auto-remove redeemed backups
self.lnworker.remove_channel_backup(self.channel_id)
@abstractmethod
def is_initiator(self) -> bool:
pass
@@ -538,8 +537,13 @@ class ChannelBackup(AbstractChannel):
self.config[LOCAL] = LocalConfig.from_seed(
channel_seed=cb.channel_seed,
to_self_delay=cb.local_delay,
# there are three cases of backups:
# 1. legacy: payment_basepoint will be derived
# 2. static_remotekey: to_remote sweep not necessary due to wallet address
# 3. anchor outputs: sweep to_remote by deriving the key from the funding pubkeys
static_remotekey=local_payment_pubkey,
# dummy values
static_payment_key=None,
dust_limit_sat=None,
max_htlc_value_in_flight_msat=None,
max_accepted_htlcs=None,
@@ -635,6 +639,9 @@ class ChannelBackup(AbstractChannel):
def get_sweep_address(self) -> str:
return self.lnworker.wallet.get_new_sweep_address_for_channel()
def has_anchors(self) -> Optional[bool]:
return None
def get_local_pubkey(self) -> bytes:
cb = self.cb
assert isinstance(cb, ChannelBackupStorage)