multi: extract path ID and total amt from received payment
We've covered all the logic for building a blinded path to ourselves and putting that into an invoice - so now we start preparing to actually be able to recognise the incoming payment as one from a blinded path we created. The incoming update_add_htlc will have an `encrypted_recipient_data` blob for us that we would have put in the original invoice. From this we extract the PathID which we wrote. We consider this the payment address and we use this to derive the associated invoice location. Blinded path payments will not include MPP records, so the payment address and total payment amount must be gleaned from the pathID and new totalAmtMsat onion field respectively. This commit only covers the final hop payload of a hop in a blinded path. Dummy hops will be handled in the following commit.
This commit is contained in:
8 files changed
+94
-18
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
sphinx "github.com/lightningnetwork/lightning-onion"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
@@ -408,6 +409,12 @@ func (h *Payload) BlindingPoint() *btcec.PublicKey {
|
||||
return h.blindingPoint
|
||||
}
|
||||
|
||||
// PathID returns the path ID that was encoded in the final hop payload of a
|
||||
// blinded payment.
|
||||
func (h *Payload) PathID() *chainhash.Hash {
|
||||
return h.FwdInfo.PathID
|
||||
}
|
||||
|
||||
// Metadata returns the additional data that is sent along with the
|
||||
// payment to the payee.
|
||||
func (h *Payload) Metadata() []byte {
|
||||
@@ -460,10 +467,6 @@ func getMinRequiredViolation(set tlv.TypeMap) *tlv.Type {
|
||||
// the route "expires" and a malicious party does not have endless opportunity
|
||||
// to probe the blinded route and compare it to updated channel policies in
|
||||
// the network.
|
||||
//
|
||||
// Note that this function only validates blinded route data for forwarding
|
||||
// nodes, as LND does not yet support receiving via a blinded route (which has
|
||||
// different validation rules).
|
||||
func ValidateBlindedRouteData(blindedData *record.BlindedRouteData,
|
||||
incomingAmount lnwire.MilliSatoshi, incomingTimelock uint32) error {
|
||||
|
||||
|
||||
Reference in new issue
Block a user