1
0

tests: lnpeer: fix cyclic lnworker.wallet.lnworker inconsistency

These better hold, lol:
wallet.lnworker.wallet == wallet
lnworker.wallet.lnworker == lnworker
This commit is contained in:
SomberNight
2025-12-19 14:36:22 +00:00
parent ea42b02ceb
commit 17f41044d5
4 changed files with 64 additions and 81 deletions

View File

@@ -25,7 +25,8 @@ from electrum.util import bfh, read_json_file, OldTaskGroup, get_asyncio_loop
from electrum.logging import console_stderr_handler
from . import ElectrumTestCase
from .test_lnpeer import keypair, MockLNWallet
from .test_lnpeer import create_mock_lnwallet
TIME_STEP = 0.01 # run tests 100 x faster
OnionMessageManager.SLEEP_DELAY *= TIME_STEP
@@ -352,7 +353,7 @@ class TestOnionMessageManager(ElectrumTestCase):
async def test_request_and_reply(self):
n = MockNetwork()
lnw = MockLNWallet(name='test_request_and_reply', has_anchors=False)
lnw = create_mock_lnwallet(name='test_request_and_reply', has_anchors=False)
def slow(*args, **kwargs):
time.sleep(2*TIME_STEP)
@@ -398,7 +399,7 @@ class TestOnionMessageManager(ElectrumTestCase):
async def test_forward(self):
n = MockNetwork()
lnw = MockLNWallet(name='alice', has_anchors=False)
lnw = create_mock_lnwallet(name='alice', has_anchors=False)
lnw.node_keypair = self.alice
self.was_sent = False
@@ -435,7 +436,7 @@ class TestOnionMessageManager(ElectrumTestCase):
async def test_receive_unsolicited(self):
n = MockNetwork()
lnw = MockLNWallet(name='dave', has_anchors=False)
lnw = create_mock_lnwallet(name='dave', has_anchors=False)
lnw.node_keypair = self.dave
t = OnionMessageManager(lnw)