Browse Source
ChannelDB.on_node_announcement: some speed-up
(e.g. for 100 node anns, was ~5 seconds, now 0.7 sec; so still slow)
regtest_lnd
SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
2 additions and
1 deletions
-
electrum/lnrouter.py
|
|
@ -447,8 +447,9 @@ class ChannelDB(SqlDB): |
|
|
|
continue |
|
|
|
node_id = node_info.node_id |
|
|
|
# Ignore node if it has no associated channel (DoS protection) |
|
|
|
# FIXME this is slow |
|
|
|
expr = or_(ChannelInfo.node1_id==node_id, ChannelInfo.node2_id==node_id) |
|
|
|
if self.DBSession.query(ChannelInfo.short_channel_id).filter(expr).count() == 0: |
|
|
|
if len(self.DBSession.query(ChannelInfo.short_channel_id).filter(expr).limit(1).all()) == 0: |
|
|
|
#self.logger.info('ignoring orphan node_announcement') |
|
|
|
continue |
|
|
|
node = self.DBSession.query(NodeInfo).filter_by(node_id=node_id).one_or_none() |
|
|
|