tests: lnchannel: also test with SRK chan type
What changed, and why it matters
This commit only changes test code. It renames several test classes from testing anchor channels to testing non-anchor channels, because a previous change had flipped the default test setting to use anchor channels. There is no change to the actual Electrum wallet or Lightning code that users run.
No security action needed. This is a routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_lnchannel.py. Previously, subclasses named Anchors set TEST_ANCHOR_CHANNELS = True to test anchor channel variants. After PR #10622 changed the base class default to True, those subclasses became redundant. This commit renames them to NoAnchors, asserts the base default is True, and sets TEST_ANCHOR_CHANNELS = False so the test suite again covers both anchor and non-anchor channel types. It is purely a test-coverage fix.
Changed components
tests/test_lnchannel.pyInspect captured patch +12 / −8
diff --git a/tests/test_lnchannel.py b/tests/test_lnchannel.py
index 4e7be7d..084914a 100644
--- a/tests/test_lnchannel.py
+++ b/tests/test_lnchannel.py
@@ -896,8 +896,9 @@ class TestChannel(ElectrumTestCase):
self.assertTrue(bob_channel.should_be_closed_due_to_expiring_htlcs(local_height=expired_height))
-class TestChannelAnchors(TestChannel):
- TEST_ANCHOR_CHANNELS = True
+class TestChannelNoAnchors(TestChannel):
+ assert TestChannel.TEST_ANCHOR_CHANNELS is True
+ TEST_ANCHOR_CHANNELS = False
class TestAvailableToSpend(ElectrumTestCase):
@@ -1012,8 +1013,9 @@ class TestAvailableToSpend(ElectrumTestCase):
self.assertEqual(1000000000, alice_channel.available_to_spend(REMOTE))
-class TestAvailableToSpendAnchors(TestAvailableToSpend):
- TEST_ANCHOR_CHANNELS = True
+class TestAvailableToSpendNoAnchors(TestAvailableToSpend):
+ assert TestAvailableToSpend.TEST_ANCHOR_CHANNELS is True
+ TEST_ANCHOR_CHANNELS = False
class TestChanReserve(ElectrumTestCase):
@@ -1149,8 +1151,9 @@ class TestChanReserve(ElectrumTestCase):
self.assertEqual(self.bob_channel.available_to_spend(LOCAL), amt2)
-class TestChanReserveAnchors(TestChanReserve):
- TEST_ANCHOR_CHANNELS = True
+class TestChanReserveNoAnchors(TestChanReserve):
+ assert TestChanReserve.TEST_ANCHOR_CHANNELS is True
+ TEST_ANCHOR_CHANNELS = False
class TestDust(ElectrumTestCase):
@@ -1216,8 +1219,9 @@ class TestDust(ElectrumTestCase):
self.assertEqual(htlc_amt, alice_channel.total_msat(SENT) // 1000)
-class TestDustAnchors(TestDust):
- TEST_ANCHOR_CHANNELS = True
+class TestDustNoAnchors(TestDust):
+ assert TestDust.TEST_ANCHOR_CHANNELS is True
+ TEST_ANCHOR_CHANNELS = False
def force_state_transition(chanA, chanB):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.