lnpeer+wallet: use channel type for channel open
* channel_type is put into storage, serialized as int and deserialized as ChannelType * check for static_remotekey is done via channel type
This commit is contained in:
@@ -52,7 +52,8 @@ from .lnutil import (Outpoint, LocalConfig, RemoteConfig, Keypair, OnlyPubkeyKey
|
||||
ScriptHtlc, PaymentFailure, calc_fees_for_commitment_tx, RemoteMisbehaving, make_htlc_output_witness_script,
|
||||
ShortChannelID, map_htlcs_to_ctx_output_idxs, LNPeerAddr,
|
||||
fee_for_htlc_output, offered_htlc_trim_threshold_sat,
|
||||
received_htlc_trim_threshold_sat, make_commitment_output_to_remote_address)
|
||||
received_htlc_trim_threshold_sat, make_commitment_output_to_remote_address,
|
||||
ChannelType)
|
||||
from .lnsweep import create_sweeptxs_for_our_ctx, create_sweeptxs_for_their_ctx
|
||||
from .lnsweep import create_sweeptx_for_their_revoked_htlc, SweepInfo
|
||||
from .lnhtlc import HTLCManager
|
||||
@@ -709,7 +710,8 @@ class Channel(AbstractChannel):
|
||||
return chan_ann
|
||||
|
||||
def is_static_remotekey_enabled(self) -> bool:
|
||||
return bool(self.storage.get('static_remotekey_enabled'))
|
||||
channel_type = ChannelType(self.storage.get('channel_type'))
|
||||
return bool(channel_type & ChannelType.OPTION_STATIC_REMOTEKEY)
|
||||
|
||||
def get_wallet_addresses_channel_might_want_reserved(self) -> Sequence[str]:
|
||||
ret = []
|
||||
@@ -925,6 +927,7 @@ class Channel(AbstractChannel):
|
||||
Action must be initiated by LOCAL.
|
||||
Finally, the next remote ctx becomes the latest remote ctx.
|
||||
"""
|
||||
# TODO: when more channel types are supported, this method should depend on channel type
|
||||
next_remote_ctn = self.get_next_ctn(REMOTE)
|
||||
self.logger.info(f"sign_next_commitment {next_remote_ctn}")
|
||||
|
||||
@@ -966,6 +969,7 @@ class Channel(AbstractChannel):
|
||||
If all checks pass, the next local ctx becomes the latest local ctx.
|
||||
"""
|
||||
# TODO in many failure cases below, we should "fail" the channel (force-close)
|
||||
# TODO: when more channel types are supported, this method should depend on channel type
|
||||
next_local_ctn = self.get_next_ctn(LOCAL)
|
||||
self.logger.info(f"receive_new_commitment. ctn={next_local_ctn}, len(htlc_sigs)={len(htlc_sigs)}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user