Skip to content

Commit be69b02

Browse files
committed
htlcswitch: remove Switch reference from channelLink
1 parent 38db17b commit be69b02

File tree

5 files changed

+395
-303
lines changed

5 files changed

+395
-303
lines changed

htlcswitch/link.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ type ChannelLinkConfig struct {
9292
// allowing the link to open and close circuits.
9393
Circuits CircuitModifier
9494

95-
// Switch provides a reference to the HTLC switch, we only use this in
96-
// testing to access circuit operations not typically exposed by the
97-
// CircuitModifier.
98-
//
99-
// TODO(conner): remove after refactoring htlcswitch testing framework.
100-
Switch *Switch
101-
10295
// BestHeight returns the best known height.
10396
BestHeight func() uint32
10497

htlcswitch/link_isolated_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ import (
1313
type linkTestContext struct {
1414
t *testing.T
1515

16-
aliceLink ChannelLink
17-
bobChannel *lnwallet.LightningChannel
18-
aliceMsgs <-chan lnwire.Message
16+
aliceSwitch *Switch
17+
aliceLink ChannelLink
18+
bobChannel *lnwallet.LightningChannel
19+
aliceMsgs <-chan lnwire.Message
1920
}
2021

2122
// sendHtlcBobToAlice sends an HTLC from Bob to Alice, that pays to a preimage
@@ -39,7 +40,7 @@ func (l *linkTestContext) sendHtlcAliceToBob(htlcID int,
3940

4041
l.t.Helper()
4142

42-
circuitMap := l.aliceLink.(*channelLink).cfg.Switch.circuits
43+
circuitMap := l.aliceSwitch.circuits
4344
fwdActions, err := circuitMap.CommitCircuits(
4445
&PaymentCircuit{
4546
Incoming: CircuitKey{

0 commit comments

Comments
 (0)