htlcswitch: remove Switch reference from channelLink
This commit is contained in:
1 parent
38db17b8cc
commit
be69b022d9
5 files changed
+395
-303
No files matched your search
@@ -92,13 +92,6 @@ type ChannelLinkConfig struct {
|
||||
// allowing the link to open and close circuits.
|
||||
Circuits CircuitModifier
|
||||
|
||||
// Switch provides a reference to the HTLC switch, we only use this in
|
||||
// testing to access circuit operations not typically exposed by the
|
||||
// CircuitModifier.
|
||||
//
|
||||
// TODO(conner): remove after refactoring htlcswitch testing framework.
|
||||
Switch *Switch
|
||||
|
||||
// BestHeight returns the best known height.
|
||||
BestHeight func() uint32
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ import (
|
||||
type linkTestContext struct {
|
||||
t *testing.T
|
||||
|
||||
aliceLink ChannelLink
|
||||
bobChannel *lnwallet.LightningChannel
|
||||
aliceMsgs <-chan lnwire.Message
|
||||
aliceSwitch *Switch
|
||||
aliceLink ChannelLink
|
||||
bobChannel *lnwallet.LightningChannel
|
||||
aliceMsgs <-chan lnwire.Message
|
||||
}
|
||||
|
||||
// sendHtlcBobToAlice sends an HTLC from Bob to Alice, that pays to a preimage
|
||||
@@ -39,7 +40,7 @@ func (l *linkTestContext) sendHtlcAliceToBob(htlcID int,
|
||||
|
||||
l.t.Helper()
|
||||
|
||||
circuitMap := l.aliceLink.(*channelLink).cfg.Switch.circuits
|
||||
circuitMap := l.aliceSwitch.circuits
|
||||
fwdActions, err := circuitMap.CommitCircuits(
|
||||
&PaymentCircuit{
|
||||
Incoming: CircuitKey{
|
||||
|
||||
+387
-290
File diff suppressed because it is too large.
Load diff
@@ -5263,10 +5263,12 @@ func testSwitchHandlePacketForward(t *testing.T, zeroConf, private,
|
||||
t.Parallel()
|
||||
|
||||
// Create a link for Alice that we'll add to the switch.
|
||||
aliceLink, _, _, _, _, err :=
|
||||
harness, err :=
|
||||
newSingleLinkTestHarness(t, btcutil.SatoshiPerBitcoin, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
aliceLink := harness.aliceLink
|
||||
|
||||
s, err := initSwitchWithTempDB(t, testStartingHeight)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to init switch: %v", err)
|
||||
|
||||
@@ -1129,7 +1129,6 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
|
||||
|
||||
link := NewChannelLink(
|
||||
ChannelLinkConfig{
|
||||
Switch: server.htlcSwitch,
|
||||
BestHeight: server.htlcSwitch.BestHeight,
|
||||
FwrdingPolicy: h.globalPolicy,
|
||||
Peer: peer,
|
||||
|
||||
Reference in new issue
Block a user