htlcswitch+router: add onion error obfuscation

Within the network, it's important that when an HTLC forwarding failure
occurs, the recipient is notified in a timely manner in order to ensure
that errors are graceful and not unknown. For that reason with
accordance to BOLT №4 onion failure obfuscation have been added.
This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-07-14 19:08:04 -07:00
1 parent ef73062c14
commit 2d378b3280
13 files changed
+639 -212

No files matched your search

+7 -1
View File
@@ -38,17 +38,23 @@ type paymentCircuit struct {
// request back.
Dest lnwire.ShortChannelID
// Obfuscator is used to obfuscate the onion failure before sending it
// back to the originator of the payment.
Obfuscator Obfuscator
// RefCount is used to count the circuits with the same circuit key.
RefCount int
}
// newPaymentCircuit creates new payment circuit instance.
func newPaymentCircuit(src, dest lnwire.ShortChannelID, key circuitKey) *paymentCircuit {
func newPaymentCircuit(src, dest lnwire.ShortChannelID, key circuitKey,
obfuscator Obfuscator) *paymentCircuit {
return &paymentCircuit{
Src: src,
Dest: dest,
PaymentHash: key,
RefCount: 1,
Obfuscator: obfuscator,
}
}