tlnrouter: fix get_last_good_address: one_or_none -> all - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit b76728d45970fc0fa58e2924792673947ff8aecc (DIR) parent 9983578df0d69390d58e92e0af448f1664d0dc6c (HTM) Author: ThomasV <thomasv@electrum.org> Date: Tue, 19 Mar 2019 12:46:54 +0100 lnrouter: fix get_last_good_address: one_or_none -> all Diffstat: M electrum/lnrouter.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- (DIR) diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py t@@ -261,14 +261,11 @@ class ChannelDB(SqlDB): @sql def get_last_good_address(self, node_id) -> Optional[LNPeerAddr]: - adr_db = self.DBSession \ - .query(Address) \ - .filter_by(node_id = node_id.hex()) \ - .order_by(Address.last_connected_date.desc()) \ - .one_or_none() - if not adr_db: + r = self.DBSession.query(Address).filter_by(node_id=node_id.hex()).order_by(Address.last_connected_date.desc()).all() + if not r: return None - return LNPeerAddr(adr_db.host, adr_db.port, bytes.fromhex(adr_db.node_id)) + addr = r[0] + return LNPeerAddr(addr.host, addr.port, bytes.fromhex(addr.node_id)) @sql def get_recent_peers(self):