commit 1600241b0221f74b30d8130e8f2e25c03814e61d
parent 7257172e1c091cfe63923d3cbd30ded4b63aba25
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 15 Apr 2020 17:39:39 +0200
fix tests: follow-up prev few commits
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/electrum/tests/test_lnpeer.py b/electrum/tests/test_lnpeer.py
@@ -17,7 +17,7 @@ from electrum.ecc import ECPrivkey
from electrum import simple_config, lnutil
from electrum.lnaddr import lnencode, LnAddr, lndecode
from electrum.bitcoin import COIN, sha256
-from electrum.util import bh2u, create_and_start_event_loop
+from electrum.util import bh2u, create_and_start_event_loop, NetworkRetryManager
from electrum.lnpeer import Peer
from electrum.lnutil import LNPeerAddr, Keypair, privkey_to_pubkey
from electrum.lnutil import LightningPeerConnectionClosed, RemoteMisbehaving
@@ -95,9 +95,10 @@ class MockWallet:
def is_lightning_backup(self):
return False
-class MockLNWallet(Logger):
+class MockLNWallet(Logger, NetworkRetryManager[LNPeerAddr]):
def __init__(self, remote_keypair, local_keypair, chan: 'Channel', tx_queue):
Logger.__init__(self)
+ NetworkRetryManager.__init__(self, max_retry_delay_normal=1, init_retry_delay_normal=1)
self.remote_keypair = remote_keypair
self.node_keypair = local_keypair
self.network = MockNetwork(tx_queue)
@@ -160,6 +161,7 @@ class MockLNWallet(Logger):
force_close_channel = LNWallet.force_close_channel
try_force_closing = LNWallet.try_force_closing
get_first_timestamp = lambda self: 0
+ on_peer_successfully_established = LNWallet.on_peer_successfully_established
class MockTransport:
diff --git a/electrum/tests/test_network.py b/electrum/tests/test_network.py
@@ -5,7 +5,7 @@ import unittest
from electrum import constants
from electrum.simple_config import SimpleConfig
from electrum import blockchain
-from electrum.interface import Interface
+from electrum.interface import Interface, ServerAddr
from electrum.crypto import sha256
from electrum.util import bh2u
@@ -24,7 +24,7 @@ class MockInterface(Interface):
self.config = config
network = MockNetwork()
network.config = config
- super().__init__(network, 'mock-server:50000:t', None)
+ super().__init__(network=network, server=ServerAddr.from_str('mock-server:50000:t'), proxy=None)
self.q = asyncio.Queue()
self.blockchain = blockchain.Blockchain(config=self.config, forkpoint=0,
parent=None, forkpoint_hash=constants.net.GENESIS, prev_hash=None)