mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
lnrpc: surface blinded payment fields in hops
This commit is contained in:
parent
014683ee66
commit
c2aebe2aa9
5 changed files with 1596 additions and 1469 deletions
File diff suppressed because it is too large
Load diff
|
@ -3116,6 +3116,32 @@ message Hop {
|
|||
|
||||
// The payment metadata to send along with the payment to the payee.
|
||||
bytes metadata = 13;
|
||||
|
||||
/*
|
||||
Blinding point is an optional blinding point included for introduction
|
||||
nodes in blinded paths. This field is mandatory for hops that represents
|
||||
the introduction point in a blinded path.
|
||||
*/
|
||||
bytes blinding_point = 14;
|
||||
|
||||
/*
|
||||
Encrypted data is a receiver-produced blob of data that provides hops
|
||||
in a blinded route with forwarding data. As this data is encrypted by
|
||||
the recipient, we will not be able to parse it - it is essentially an
|
||||
arbitrary blob of data from our node's perspective. This field is
|
||||
mandatory for all hops in a blinded path, including the introduction
|
||||
node.
|
||||
*/
|
||||
bytes encrypted_data = 15;
|
||||
|
||||
/*
|
||||
The total amount that is sent to the recipient (possibly across multiple
|
||||
HTLCs), as specified by the sender when making a payment to a blinded path.
|
||||
This value is only set in the final hop payload of a blinded payment. This
|
||||
value is analogous to the MPPRecord that is used for regular (non-blinded)
|
||||
MPP payments.
|
||||
*/
|
||||
uint64 total_amt_msat = 16;
|
||||
}
|
||||
|
||||
message MPPRecord {
|
||||
|
|
|
@ -5045,6 +5045,21 @@
|
|||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The payment metadata to send along with the payment to the payee."
|
||||
},
|
||||
"blinding_point": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Blinding point is an optional blinding point included for introduction\nnodes in blinded paths. This field is mandatory for hops that represents\nthe introduction point in a blinded path."
|
||||
},
|
||||
"encrypted_data": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Encrypted data is a receiver-produced blob of data that provides hops\nin a blinded route with forwarding data. As this data is encrypted by\nthe recipient, we will not be able to parse it - it is essentially an\narbitrary blob of data from our node's perspective. This field is\nmandatory for all hops in a blinded path, including the introduction\nnode."
|
||||
},
|
||||
"total_amt_msat": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The total amount that is sent to the recipient (possibly across multiple\nHTLCs), as specified by the sender when making a payment to a blinded path.\nThis value is only set in the final hop payload of a blinded payment. This\nvalue is analogous to the MPPRecord that is used for regular (non-blinded)\nMPP payments."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -873,6 +873,21 @@
|
|||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The payment metadata to send along with the payment to the payee."
|
||||
},
|
||||
"blinding_point": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Blinding point is an optional blinding point included for introduction\nnodes in blinded paths. This field is mandatory for hops that represents\nthe introduction point in a blinded path."
|
||||
},
|
||||
"encrypted_data": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Encrypted data is a receiver-produced blob of data that provides hops\nin a blinded route with forwarding data. As this data is encrypted by\nthe recipient, we will not be able to parse it - it is essentially an\narbitrary blob of data from our node's perspective. This field is\nmandatory for all hops in a blinded path, including the introduction\nnode."
|
||||
},
|
||||
"total_amt_msat": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The total amount that is sent to the recipient (possibly across multiple\nHTLCs), as specified by the sender when making a payment to a blinded path.\nThis value is only set in the final hop payload of a blinded payment. This\nvalue is analogous to the MPPRecord that is used for regular (non-blinded)\nMPP payments."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -424,6 +424,13 @@ func (r *RouterBackend) MarshallRoute(route *route.Route) (*lnrpc.Route, error)
|
|||
TlvPayload: !hop.LegacyPayload,
|
||||
MppRecord: mpp,
|
||||
Metadata: hop.Metadata,
|
||||
EncryptedData: hop.EncryptedData,
|
||||
TotalAmtMsat: uint64(hop.TotalAmtMsat),
|
||||
}
|
||||
|
||||
if hop.BlindingPoint != nil {
|
||||
blinding := hop.BlindingPoint.SerializeCompressed()
|
||||
resp.Hops[i].BlindingPoint = blinding
|
||||
}
|
||||
incomingAmt = hop.AmtToForward
|
||||
}
|
||||
|
@ -451,7 +458,7 @@ func UnmarshallHopWithPubkey(rpcHop *lnrpc.Hop, pubkey route.Vertex) (*route.Hop
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return &route.Hop{
|
||||
hop := &route.Hop{
|
||||
OutgoingTimeLock: rpcHop.Expiry,
|
||||
AmtToForward: lnwire.MilliSatoshi(rpcHop.AmtToForwardMsat),
|
||||
PubKeyBytes: pubkey,
|
||||
|
@ -460,7 +467,26 @@ func UnmarshallHopWithPubkey(rpcHop *lnrpc.Hop, pubkey route.Vertex) (*route.Hop
|
|||
LegacyPayload: false,
|
||||
MPP: mpp,
|
||||
AMP: amp,
|
||||
}, nil
|
||||
EncryptedData: rpcHop.EncryptedData,
|
||||
TotalAmtMsat: lnwire.MilliSatoshi(rpcHop.TotalAmtMsat),
|
||||
}
|
||||
|
||||
haveBlindingPoint := len(rpcHop.BlindingPoint) != 0
|
||||
if haveBlindingPoint {
|
||||
hop.BlindingPoint, err = btcec.ParsePubKey(
|
||||
rpcHop.BlindingPoint,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("blinding point: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if haveBlindingPoint && len(rpcHop.EncryptedData) == 0 {
|
||||
return nil, errors.New("encrypted data should be present if " +
|
||||
"blinding point is provided")
|
||||
}
|
||||
|
||||
return hop, nil
|
||||
}
|
||||
|
||||
// UnmarshallHop unmarshalls an rpc hop that may or may not contain a node
|
||||
|
|
Loading…
Add table
Reference in a new issue