htlcswitch/test: add forward mock result

This commit is contained in:
Joost Jager 2019-10-09 16:58:51 +02:00
parent cb85095ab0
commit 4ea8927845
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
2 changed files with 7 additions and 4 deletions

@ -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)
}