Htlcswitch: rename Deobfuscator and Obfuscator interfaces

This commit renames the Deobfuscator interface to ErrorDecrypter and
the Obfuscator interface to ErrorEncrypter. With this rename, the
purpose of these two interfaces are a bit clearer.

Additionally, DecryptError (which was formerly Deobfuscate) now
directly returns an ForwardingError type instead of the
lnwire.FailureMessage.
This commit is contained in:
Olaoluwa Osuntokun
2017-10-10 19:36:52 -07:00
parent 30a46291f8
commit 12ae63101d
9 changed files with 109 additions and 93 deletions

View File

@@ -35,10 +35,7 @@ type htlcPacket struct {
// obfuscator contains the necessary state to allow the switch to wrap
// any forwarded errors in an additional layer of encryption.
//
// TODO(andrew.shvv) revisit after refactoring the way of returning
// errors inside the htlcswitch packet.
obfuscator Obfuscator
obfuscator ErrorEncrypter
// isObfuscated is set to true if an error occurs as soon as the switch
// forwards a packet to the link. If so, and this is an error packet,
@@ -61,13 +58,13 @@ func newInitPacket(destNode [33]byte, htlc *lnwire.UpdateAddHTLC) *htlcPacket {
// newAddPacket creates htlc switch add packet which encapsulates the add htlc
// request and additional information for proper forwarding over htlc switch.
func newAddPacket(src, dest lnwire.ShortChannelID,
htlc *lnwire.UpdateAddHTLC, obfuscator Obfuscator) *htlcPacket {
htlc *lnwire.UpdateAddHTLC, e ErrorEncrypter) *htlcPacket {
return &htlcPacket{
dest: dest,
src: src,
htlc: htlc,
obfuscator: obfuscator,
obfuscator: e,
}
}