mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
htlcswitch: remove Switch reference from channelLink
This commit is contained in:
parent
38db17b8cc
commit
be69b022d9
@ -92,13 +92,6 @@ type ChannelLinkConfig struct {
|
|||||||
// allowing the link to open and close circuits.
|
// allowing the link to open and close circuits.
|
||||||
Circuits CircuitModifier
|
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 returns the best known height.
|
||||||
BestHeight func() uint32
|
BestHeight func() uint32
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ import (
|
|||||||
type linkTestContext struct {
|
type linkTestContext struct {
|
||||||
t *testing.T
|
t *testing.T
|
||||||
|
|
||||||
aliceLink ChannelLink
|
aliceSwitch *Switch
|
||||||
bobChannel *lnwallet.LightningChannel
|
aliceLink ChannelLink
|
||||||
aliceMsgs <-chan lnwire.Message
|
bobChannel *lnwallet.LightningChannel
|
||||||
|
aliceMsgs <-chan lnwire.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendHtlcBobToAlice sends an HTLC from Bob to Alice, that pays to a preimage
|
// 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()
|
l.t.Helper()
|
||||||
|
|
||||||
circuitMap := l.aliceLink.(*channelLink).cfg.Switch.circuits
|
circuitMap := l.aliceSwitch.circuits
|
||||||
fwdActions, err := circuitMap.CommitCircuits(
|
fwdActions, err := circuitMap.CommitCircuits(
|
||||||
&PaymentCircuit{
|
&PaymentCircuit{
|
||||||
Incoming: CircuitKey{
|
Incoming: CircuitKey{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5263,10 +5263,12 @@ func testSwitchHandlePacketForward(t *testing.T, zeroConf, private,
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
// Create a link for Alice that we'll add to the switch.
|
// Create a link for Alice that we'll add to the switch.
|
||||||
aliceLink, _, _, _, _, err :=
|
harness, err :=
|
||||||
newSingleLinkTestHarness(t, btcutil.SatoshiPerBitcoin, 0)
|
newSingleLinkTestHarness(t, btcutil.SatoshiPerBitcoin, 0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
aliceLink := harness.aliceLink
|
||||||
|
|
||||||
s, err := initSwitchWithTempDB(t, testStartingHeight)
|
s, err := initSwitchWithTempDB(t, testStartingHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to init switch: %v", err)
|
t.Fatalf("unable to init switch: %v", err)
|
||||||
|
@ -1129,7 +1129,6 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
|
|||||||
|
|
||||||
link := NewChannelLink(
|
link := NewChannelLink(
|
||||||
ChannelLinkConfig{
|
ChannelLinkConfig{
|
||||||
Switch: server.htlcSwitch,
|
|
||||||
BestHeight: server.htlcSwitch.BestHeight,
|
BestHeight: server.htlcSwitch.BestHeight,
|
||||||
FwrdingPolicy: h.globalPolicy,
|
FwrdingPolicy: h.globalPolicy,
|
||||||
Peer: peer,
|
Peer: peer,
|
||||||
|
Loading…
Reference in New Issue
Block a user