htlcswitch: add incoming amount and to decode hop iterator request

When we have payments inside of a blinded route, we need to know
the incoming amount to be able to back-calculate the amount that
we need to forward using the forwarding parameters provided in the
blinded route encrypted data. This commit adds the payment amount
to our DecodeHopIteratorRequest so that it can be threaded down to
payment forwarding information creation in later commits.
This commit is contained in:
Carla Kirk-Cohen
2023-01-27 14:19:56 -05:00
parent 7bf1daaade
commit 7265e4c9b0
2 changed files with 10 additions and 8 deletions

View File

@@ -175,10 +175,11 @@ func (p *OnionProcessor) ReconstructHopIterator(r io.Reader, rHash []byte) (
// packet, perform sphinx replay detection, and schedule the entry for garbage
// collection.
type DecodeHopIteratorRequest struct {
OnionReader io.Reader
RHash []byte
IncomingCltv uint32
BlindingPoint *btcec.PublicKey
OnionReader io.Reader
RHash []byte
IncomingCltv uint32
IncomingAmount lnwire.MilliSatoshi
BlindingPoint *btcec.PublicKey
}
// DecodeHopIteratorResponse encapsulates the outcome of a batched sphinx onion

View File

@@ -3160,10 +3160,11 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
onionReader := bytes.NewReader(pd.OnionBlob)
req := hop.DecodeHopIteratorRequest{
OnionReader: onionReader,
RHash: pd.RHash[:],
IncomingCltv: pd.Timeout,
BlindingPoint: pd.BlindingPoint,
OnionReader: onionReader,
RHash: pd.RHash[:],
IncomingCltv: pd.Timeout,
IncomingAmount: pd.Amount,
BlindingPoint: pd.BlindingPoint,
}
decodeReqs = append(decodeReqs, req)