diff --git a/htlcswitch/mailbox.go b/htlcswitch/mailbox.go index 99066497c..a729e3ba5 100644 --- a/htlcswitch/mailbox.go +++ b/htlcswitch/mailbox.go @@ -738,6 +738,7 @@ func (m *memoryMailBox) FailAdd(pkt *htlcPacket) { sourceRef: pkt.sourceRef, hasSource: true, localFailure: localFailure, + obfuscator: pkt.obfuscator, linkFailure: linkError, htlc: &lnwire.UpdateFailHTLC{ Reason: reason, diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 70b819b1e..d473d8422 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -1297,6 +1297,11 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error { fail, isFail := htlc.(*lnwire.UpdateFailHTLC) if isFail && !packet.hasSource { + // HTLC resolutions and messages restored from disk + // don't have the obfuscator set from the original htlc + // add packet - set it here for use in blinded errors. + packet.obfuscator = circuit.ErrorEncrypter + switch { // No message to encrypt, locally sourced payment. case circuit.ErrorEncrypter == nil: @@ -1485,6 +1490,7 @@ func (s *Switch) failAddPacket(packet *htlcPacket, failure *LinkError) error { incomingTimeout: packet.incomingTimeout, outgoingTimeout: packet.outgoingTimeout, circuit: packet.circuit, + obfuscator: packet.obfuscator, linkFailure: failure, htlc: &lnwire.UpdateFailHTLC{ Reason: reason, @@ -1841,6 +1847,10 @@ out: // resolution message on restart. resolutionMsg.errChan <- nil + // Create a htlc packet for this resolution. We do + // not have some of the information that we'll need + // for blinded error handling here , so we'll rely on + // our forwarding logic to fill it in later. pkt := &htlcPacket{ outgoingChanID: resolutionMsg.SourceChan, outgoingHTLCID: resolutionMsg.HtlcIndex, @@ -2065,6 +2075,8 @@ func (s *Switch) reforwardResolutions() error { // The circuit is still open, so we can assume that the link or // switch (if we are the source) hasn't cleaned it up yet. + // We rely on our forwarding logic to fill in details that + // are not currently available to us. resPkt := &htlcPacket{ outgoingChanID: resMsg.SourceChan, outgoingHTLCID: resMsg.HtlcIndex, @@ -2214,7 +2226,8 @@ func (s *Switch) reforwardSettleFails(fwdPkgs []*channeldb.FwdPkg) { // we can continue to propagate it. This // failure originated from another node, so // the linkFailure field is not set on this - // packet. + // packet. We rely on the link to fill in + // additional circuit information for us. failPacket := &htlcPacket{ outgoingChanID: fwdPkg.Source, outgoingHTLCID: pd.ParentIndex,