1
0

lnworker: always initialize self.config in constructor

This commit is contained in:
ThomasV
2023-11-13 14:54:40 +01:00
parent 6865204d7b
commit 7447cf9dcc
2 changed files with 3 additions and 4 deletions

View File

@@ -249,7 +249,6 @@ class LNWorker(Logger, EventListener, NetworkRetryManager[LNPeerAddr]):
self.listen_server = None # type: Optional[asyncio.AbstractServer]
self.features = features
self.network = None # type: Optional[Network]
self.config = None # type: Optional[SimpleConfig]
self.stopping_soon = False # whether we are being shut down
self._labels_cache = {} # txid -> str
self.register_callbacks()
@@ -373,7 +372,6 @@ class LNWorker(Logger, EventListener, NetworkRetryManager[LNPeerAddr]):
assert network
assert self.network is None, "already started"
self.network = network
self.config = network.config
self._add_peers_from_config()
asyncio.run_coroutine_threadsafe(self.main_loop(), self.network.asyncio_loop)
@@ -557,7 +555,8 @@ class LNGossip(LNWorker):
max_age = 14*24*3600
LOGGING_SHORTCUT = 'g'
def __init__(self):
def __init__(self, config):
self.config = config
seed = os.urandom(32)
node = BIP32Node.from_rootseed(seed, xtype='standard')
xprv = node.to_xprv()

View File

@@ -369,7 +369,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
self.channel_db = channel_db.ChannelDB(self)
self.path_finder = lnrouter.LNPathFinder(self.channel_db)
self.channel_db.load_data()
self.lngossip = lnworker.LNGossip()
self.lngossip = lnworker.LNGossip(self.config)
self.lngossip.start_network(self)
async def stop_gossip(self, *, full_shutdown: bool = False):