5252from .lntransport import LNTransport , LNTransportBase , LightningPeerConnectionClosed , HandshakeFailed
5353from .lnmsg import encode_msg , decode_msg , UnknownOptionalMsgType , FailedToParseMsg
5454from .interface import GracefulDisconnect
55- from .json_db import StoredDict
5655from .invoices import PR_PAID
5756from .fee_policy import FEE_LN_ETA_TARGET , FEERATE_PER_KW_MIN_RELAY_LIGHTNING
5857from .channel_db import FLAG_DIRECTION
@@ -1211,10 +1210,10 @@ async def channel_establishment_flow(
12111210 self .send_warning (channel_id , message = str (e ), close_connection = True )
12121211 chan .open_with_first_pcp (remote_per_commitment_point , remote_sig )
12131212 chan .set_state (ChannelState .OPENING )
1213+ chan = self .lnworker .add_new_channel (chan )
12141214 if zeroconf :
12151215 chan .set_state (ChannelState .FUNDED )
12161216 self .send_channel_ready (chan )
1217- self .lnworker .add_new_channel (chan )
12181217 return chan , funding_tx
12191218
12201219 def create_channel_storage (self , channel_id , outpoint , local_config , remote_config , constraints , channel_type ):
@@ -1235,7 +1234,7 @@ def create_channel_storage(self, channel_id, outpoint, local_config, remote_conf
12351234 "revocation_store" : {},
12361235 "channel_type" : channel_type ,
12371236 }
1238- return StoredDict ( chan_dict , self . lnworker . db )
1237+ return chan_dict
12391238
12401239 @non_blocking_msg_handler
12411240 async def on_open_channel (self , payload ):
@@ -1431,13 +1430,13 @@ async def on_open_channel(self, payload):
14311430 self .funding_signed_sent .add (chan .channel_id )
14321431 chan .open_with_first_pcp (payload ['first_per_commitment_point' ], remote_sig )
14331432 chan .set_state (ChannelState .OPENING )
1433+ chan = self .lnworker .add_new_channel (chan )
14341434 if is_zeroconf :
14351435 # FIXME shouldn't we wait until funding_tx is at least in the mempool?!
14361436 # We haven't even validated funding_tx really contains the multisig funding output!
14371437 # This is unsafe. MUST be reworked before mainnet usage.
14381438 chan .set_state (ChannelState .FUNDED )
14391439 self .send_channel_ready (chan )
1440- self .lnworker .add_new_channel (chan )
14411440
14421441 def _cleanup_temp_channelids (self ) -> None :
14431442 self .temp_id_to_id = {
0 commit comments