htlcswitch/test: add forward mock result
This commit is contained in:
parent
cb85095ab0
commit
4ea8927845
@ -640,7 +640,9 @@ type mockChannelLink struct {
|
|||||||
|
|
||||||
htlcID uint64
|
htlcID uint64
|
||||||
|
|
||||||
htlcSatifiesPolicyLocalResult lnwire.FailureMessage
|
checkHtlcTransitResult lnwire.FailureMessage
|
||||||
|
|
||||||
|
checkHtlcForwardResult lnwire.FailureMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
// completeCircuit is a helper method for adding the finalized payment circuit
|
// completeCircuit is a helper method for adding the finalized payment circuit
|
||||||
@ -701,14 +703,15 @@ func (f *mockChannelLink) UpdateForwardingPolicy(_ ForwardingPolicy) {
|
|||||||
}
|
}
|
||||||
func (f *mockChannelLink) CheckHtlcForward([32]byte, lnwire.MilliSatoshi,
|
func (f *mockChannelLink) CheckHtlcForward([32]byte, lnwire.MilliSatoshi,
|
||||||
lnwire.MilliSatoshi, uint32, uint32, uint32) lnwire.FailureMessage {
|
lnwire.MilliSatoshi, uint32, uint32, uint32) lnwire.FailureMessage {
|
||||||
return nil
|
|
||||||
|
return f.checkHtlcForwardResult
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *mockChannelLink) CheckHtlcTransit(payHash [32]byte,
|
func (f *mockChannelLink) CheckHtlcTransit(payHash [32]byte,
|
||||||
amt lnwire.MilliSatoshi, timeout uint32,
|
amt lnwire.MilliSatoshi, timeout uint32,
|
||||||
heightNow uint32) lnwire.FailureMessage {
|
heightNow uint32) lnwire.FailureMessage {
|
||||||
|
|
||||||
return f.htlcSatifiesPolicyLocalResult
|
return f.checkHtlcTransitResult
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *mockChannelLink) Stats() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi) {
|
func (f *mockChannelLink) Stats() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi) {
|
||||||
|
@ -1405,7 +1405,7 @@ func testSkipLinkLocalForward(t *testing.T, eligible bool,
|
|||||||
aliceChannelLink := newMockChannelLink(
|
aliceChannelLink := newMockChannelLink(
|
||||||
s, chanID1, aliceChanID, alicePeer, eligible,
|
s, chanID1, aliceChanID, alicePeer, eligible,
|
||||||
)
|
)
|
||||||
aliceChannelLink.htlcSatifiesPolicyLocalResult = policyResult
|
aliceChannelLink.checkHtlcTransitResult = policyResult
|
||||||
if err := s.AddLink(aliceChannelLink); err != nil {
|
if err := s.AddLink(aliceChannelLink); err != nil {
|
||||||
t.Fatalf("unable to add alice link: %v", err)
|
t.Fatalf("unable to add alice link: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user