lnrpc+routerrpc: disable custom tlv records via rpc
In order to prevent future unforeseen issues, we are temporarily disabling the ability to send custom tlv records to the receiver of a payment. Currently the receiver does not process or expose these additional fields via rpc or internally, so they are being disabled until the end-to-end flow is finished and fully validated.
This commit is contained in:
4 files changed
+541
-611
No files matched your search
@@ -165,6 +165,7 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
|
|||||||
ignoredPairs[pair] = struct{}{}
|
ignoredPairs[pair] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var destTLV map[uint64][]byte
|
||||||
restrictions := &routing.RestrictParams{
|
restrictions := &routing.RestrictParams{
|
||||||
FeeLimit: feeLimit,
|
FeeLimit: feeLimit,
|
||||||
ProbabilitySource: func(fromNode, toNode route.Vertex,
|
ProbabilitySource: func(fromNode, toNode route.Vertex,
|
||||||
@@ -190,13 +191,13 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
|
|||||||
fromNode, toNode, amt,
|
fromNode, toNode, amt,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
DestPayloadTLV: len(in.DestTlv) != 0,
|
DestPayloadTLV: len(destTLV) != 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have any TLV records destined for the final hop, then we'll
|
// If we have any TLV records destined for the final hop, then we'll
|
||||||
// attempt to decode them now into a form that the router can more
|
// attempt to decode them now into a form that the router can more
|
||||||
// easily manipulate.
|
// easily manipulate.
|
||||||
destTlvRecords, err := tlv.MapToRecords(in.DestTlv)
|
destTlvRecords, err := tlv.MapToRecords(destTLV)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -332,11 +333,6 @@ func (r *RouterBackend) MarshallRoute(route *route.Route) (*lnrpc.Route, error)
|
|||||||
chanCapacity = incomingAmt.ToSatoshis()
|
chanCapacity = incomingAmt.ToSatoshis()
|
||||||
}
|
}
|
||||||
|
|
||||||
tlvMap, err := tlv.RecordsToMap(hop.TLVRecords)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
resp.Hops[i] = &lnrpc.Hop{
|
resp.Hops[i] = &lnrpc.Hop{
|
||||||
ChanId: hop.ChannelID,
|
ChanId: hop.ChannelID,
|
||||||
ChanCapacity: int64(chanCapacity),
|
ChanCapacity: int64(chanCapacity),
|
||||||
@@ -348,7 +344,6 @@ func (r *RouterBackend) MarshallRoute(route *route.Route) (*lnrpc.Route, error)
|
|||||||
PubKey: hex.EncodeToString(
|
PubKey: hex.EncodeToString(
|
||||||
hop.PubKeyBytes[:],
|
hop.PubKeyBytes[:],
|
||||||
),
|
),
|
||||||
TlvRecords: tlvMap,
|
|
||||||
TlvPayload: !hop.LegacyPayload,
|
TlvPayload: !hop.LegacyPayload,
|
||||||
}
|
}
|
||||||
incomingAmt = hop.AmtToForward
|
incomingAmt = hop.AmtToForward
|
||||||
@@ -380,10 +375,7 @@ func (r *RouterBackend) UnmarshallHopByChannelLookup(hop *lnrpc.Hop,
|
|||||||
return nil, fmt.Errorf("channel edge does not match expected node")
|
return nil, fmt.Errorf("channel edge does not match expected node")
|
||||||
}
|
}
|
||||||
|
|
||||||
tlvRecords, err := tlv.MapToRecords(hop.TlvRecords)
|
var tlvRecords []tlv.Record
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &route.Hop{
|
return &route.Hop{
|
||||||
OutgoingTimeLock: hop.Expiry,
|
OutgoingTimeLock: hop.Expiry,
|
||||||
@@ -408,12 +400,6 @@ func UnmarshallKnownPubkeyHop(hop *lnrpc.Hop) (*route.Hop, error) {
|
|||||||
copy(pubKeyBytes[:], pubKey)
|
copy(pubKeyBytes[:], pubKey)
|
||||||
|
|
||||||
var tlvRecords []tlv.Record
|
var tlvRecords []tlv.Record
|
||||||
if hop.TlvRecords != nil {
|
|
||||||
tlvRecords, err = tlv.MapToRecords(hop.TlvRecords)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &route.Hop{
|
return &route.Hop{
|
||||||
OutgoingTimeLock: hop.Expiry,
|
OutgoingTimeLock: hop.Expiry,
|
||||||
@@ -501,11 +487,10 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
|||||||
return nil, errors.New("timeout_seconds must be specified")
|
return nil, errors.New("timeout_seconds must be specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rpcPayReq.DestTlv) != 0 {
|
var destTLV map[uint64][]byte
|
||||||
|
if len(destTLV) != 0 {
|
||||||
var err error
|
var err error
|
||||||
payIntent.FinalDestRecords, err = tlv.MapToRecords(
|
payIntent.FinalDestRecords, err = tlv.MapToRecords(destTLV)
|
||||||
rpcPayReq.DestTlv,
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
+532
-563
File diff suppressed because it is too large.
Load diff
+1
-17
@@ -1741,14 +1741,6 @@ message QueryRoutesRequest {
|
|||||||
A list of directed node pairs that will be ignored during path finding.
|
A list of directed node pairs that will be ignored during path finding.
|
||||||
*/
|
*/
|
||||||
repeated NodePair ignored_pairs = 10;
|
repeated NodePair ignored_pairs = 10;
|
||||||
|
|
||||||
/**
|
|
||||||
An optional field that can be used to pass an arbitrary set of TLV records
|
|
||||||
to a peer which understands the new records. This can be used to pass
|
|
||||||
application specific data during the payment attempt. If the destination
|
|
||||||
does not support the specified recrods, and error will be returned.
|
|
||||||
*/
|
|
||||||
map<uint64, bytes> dest_tlv = 11;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodePair {
|
message NodePair {
|
||||||
@@ -1808,17 +1800,9 @@ message Hop {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
If set to true, then this hop will be encoded using the new variable length
|
If set to true, then this hop will be encoded using the new variable length
|
||||||
TLV format. Note that if any custom tlv_records below are specified, then
|
TLV format.
|
||||||
this field MUST be set to true for them to be encoded properly.
|
|
||||||
*/
|
*/
|
||||||
bool tlv_payload = 9 [json_name = "tlv_payload"];
|
bool tlv_payload = 9 [json_name = "tlv_payload"];
|
||||||
|
|
||||||
/**
|
|
||||||
An optional set of key-value TLV records. This is useful within the context
|
|
||||||
of the SendToRoute call as it allows callers to specify arbitrary K-V pairs
|
|
||||||
to drop off at each hop within the onion.
|
|
||||||
*/
|
|
||||||
map<uint64, bytes> tlv_records = 10 [json_name = "tlv_records"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2384,15 +2384,7 @@
|
|||||||
"tlv_payload": {
|
"tlv_payload": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"format": "boolean",
|
"format": "boolean",
|
||||||
"description": "* \nIf set to true, then this hop will be encoded using the new variable length\nTLV format. Note that if any custom tlv_records below are specified, then\nthis field MUST be set to true for them to be encoded properly."
|
"description": "* \nIf set to true, then this hop will be encoded using the new variable length\nTLV format."
|
||||||
},
|
|
||||||
"tlv_records": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "byte"
|
|
||||||
},
|
|
||||||
"description": "*\nAn optional set of key-value TLV records. This is useful within the context\nof the SendToRoute call as it allows callers to specify arbitrary K-V pairs\nto drop off at each hop within the onion."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user