electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit eaacecf4a17d848a449c84970168161fc4890329
parent a1c02e2c45307e0f1500593ef4937a772215e7c9
Author: Jin Eguchi <wakiyamap@gmail.com>
Date:   Wed, 25 Nov 2020 05:39:30 +0900

Fix get_running_loop (python<3.7) (#6765)


Diffstat:
Melectrum/lnrater.py | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/electrum/lnrater.py b/electrum/lnrater.py @@ -11,8 +11,14 @@ from pprint import pformat from random import choices from statistics import mean, median, stdev from typing import TYPE_CHECKING, Dict, NamedTuple, Tuple, List +import sys import time +if sys.version_info[:2] >= (3, 7): + from asyncio import get_running_loop +else: + from asyncio import _get_running_loop as get_running_loop # noqa: F401 + from .logging import Logger from .util import profiler from .lnrouter import fee_for_edge_msat @@ -119,7 +125,7 @@ class LNRater(Logger): async def _analyze_graph(self): await self.channel_db.data_loaded.wait() self._collect_policies_by_node() - loop = asyncio.get_running_loop() + loop = get_running_loop() # the analysis is run in an executor because it's costly await loop.run_in_executor(None, self._collect_purged_stats) self._rate_nodes()