htlcswitch: use LinkError for internal errors

Update the ChannelLink interface to specifically
return the LinkError struct. This error implements
the ClearTextError interface, so will be picked
up as a routing realted error by the router.

With LinkErrors implemented, the switch now
returns a LinkError for all failures on our
incoming/outgoing link and ForwardingError when
the failure occurs down the line.
This commit is contained in:
carla committed 2020-01-14 15:21:15 +02:00
1 parent b5a2d75465
commit f430fd50c5
8 files changed
+185 -79

No files matched your search

+4 -4
View File
@@ -645,9 +645,9 @@ type mockChannelLink struct {
htlcID uint64
checkHtlcTransitResult lnwire.FailureMessage
checkHtlcTransitResult *LinkError
checkHtlcForwardResult lnwire.FailureMessage
checkHtlcForwardResult *LinkError
}
// completeCircuit is a helper method for adding the finalized payment circuit
@@ -707,14 +707,14 @@ func (f *mockChannelLink) HandleChannelUpdate(lnwire.Message) {
func (f *mockChannelLink) UpdateForwardingPolicy(_ ForwardingPolicy) {
}
func (f *mockChannelLink) CheckHtlcForward([32]byte, lnwire.MilliSatoshi,
lnwire.MilliSatoshi, uint32, uint32, uint32) lnwire.FailureMessage {
lnwire.MilliSatoshi, uint32, uint32, uint32) *LinkError {
return f.checkHtlcForwardResult
}
func (f *mockChannelLink) CheckHtlcTransit(payHash [32]byte,
amt lnwire.MilliSatoshi, timeout uint32,
heightNow uint32) lnwire.FailureMessage {
heightNow uint32) *LinkError {
return f.checkHtlcTransitResult
}