htlcswitch: introduce wrapper type error encrypter to identify blinded
Introduce two wrapper types for our existing SphinxErrorEncrypter that are used to represent error encrypters where we're a part of a blinded route. These encrypters are functionally the same as a sphinx encrypter, and are just used as "markers" so that we know that we need to handle our error differently due to our different role. We need to persist this information to account for restart cases where we've resovled the outgoing HTLC, then restart and need to handle the error for the incoming link. Specifically, this is relevant for: - On chain resolution messages received after restart - Forwarding packages that are re-forwarded after restart This is also generally helpful, because we can store this information in one place (the circuit) rather than trying to reconstruct it in various places when forwarding the failure back over the switch.
This commit is contained in:
2 files changed
+82
-1
No files matched your search
@@ -205,6 +205,12 @@ func (c *PaymentCircuit) Decode(r io.Reader) error {
|
||||
// Test encrypter.
|
||||
c.ErrorEncrypter = NewMockObfuscator()
|
||||
|
||||
case hop.EncrypterTypeIntroduction:
|
||||
c.ErrorEncrypter = hop.NewIntroductionErrorEncrypter()
|
||||
|
||||
case hop.EncrypterTypeRelaying:
|
||||
c.ErrorEncrypter = hop.NewRelayingErrorEncrypter()
|
||||
|
||||
default:
|
||||
return UnknownEncrypterType(encrypterType)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user