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