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:
8 files changed
+185
-79
No files matched your search
+4
-4
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user