htlcswitch: introduce new ForwardingError type

This commit introduces a new type to the package: ForwardingError. It
wraps an existing lnwire.FailureMessage interface, and also includes
the _source_ of the error message. By including the source of the
message, the router can now prune the set of available routes down in
order to reduce the number of subsequent failures based on the source
of the error and the type of the error itself.
This commit is contained in:
Olaoluwa Osuntokun 2017-10-10 19:31:44 -07:00
parent 40dfa5c8fc
commit 30a46291f8
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -7,7 +7,16 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
)
// Deobfuscator is an interface that is used to decrypt the onion encrypted
// ForwardingError wraps an lnwire.FailureMessage in a struct that also
// includes the source of the error.
type ForwardingError struct {
// ErrorSource is the public key of the node that sent the error. With
// this information, the dispatcher of a payment can modify their set
// of candidate routes in response to the type of error extracted.
ErrorSource *btcec.PublicKey
lnwire.FailureMessage
}
// failure reason an extra out a well formed error.
type Deobfuscator interface {
// Deobfuscate peels off each layer of onion encryption from the first