From 421433039bb599de65238d35b5c85d94377f1771 Mon Sep 17 00:00:00 2001 From: Carla Kirk-Cohen Date: Thu, 15 Feb 2024 14:16:29 -0500 Subject: [PATCH] lnrpc: rename proportional fee rate on lnrpc This field is incorrectly suffixed as "msat", when it is actually interpreted as the proportional fee rate. This is the value that we should be using because the sender will calculate proportional fees accordingly. This is a breaking change to the RPC, but on an experimental and unreleased API. --- cmd/lncli/cmd_payments.go | 4 ++-- lnrpc/lightning.pb.go | 15 ++++++++------- lnrpc/lightning.proto | 7 +++++-- lnrpc/lightning.swagger.json | 8 ++++---- lnrpc/routerrpc/router_backend.go | 16 +++++++--------- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/cmd/lncli/cmd_payments.go b/cmd/lncli/cmd_payments.go index 1ba3b42c88..9ba6f296d1 100644 --- a/cmd/lncli/cmd_payments.go +++ b/cmd/lncli/cmd_payments.go @@ -1250,9 +1250,9 @@ func parseBlindedPaymentParameters(ctx *cli.Context) ( BaseFeeMsat: ctx.Uint64( blindedBaseFlag.Name, ), - ProportionalFeeMsat: ctx.Uint64( + ProportionalFeeRate: uint32(ctx.Uint64( blindedPPMFlag.Name, - ), + )), TotalCltvDelta: uint32(ctx.Uint64( blindedCLTVFlag.Name, )), diff --git a/lnrpc/lightning.pb.go b/lnrpc/lightning.pb.go index fb6804b718..81d1f9fb26 100644 --- a/lnrpc/lightning.pb.go +++ b/lnrpc/lightning.pb.go @@ -11992,8 +11992,9 @@ type BlindedPaymentPath struct { BlindedPath *BlindedPath `protobuf:"bytes,1,opt,name=blinded_path,json=blindedPath,proto3" json:"blinded_path,omitempty"` // The base fee for the blinded path provided, expressed in msat. BaseFeeMsat uint64 `protobuf:"varint,2,opt,name=base_fee_msat,json=baseFeeMsat,proto3" json:"base_fee_msat,omitempty"` - // The proportional fee for the blinded path provided, expressed in msat. - ProportionalFeeMsat uint64 `protobuf:"varint,3,opt,name=proportional_fee_msat,json=proportionalFeeMsat,proto3" json:"proportional_fee_msat,omitempty"` + // The proportional fee for the blinded path provided, expressed in parts + // per million. + ProportionalFeeRate uint32 `protobuf:"varint,3,opt,name=proportional_fee_rate,json=proportionalFeeRate,proto3" json:"proportional_fee_rate,omitempty"` // The total CLTV delta for the blinded path provided, including the // final CLTV delta for the receiving node. TotalCltvDelta uint32 `protobuf:"varint,4,opt,name=total_cltv_delta,json=totalCltvDelta,proto3" json:"total_cltv_delta,omitempty"` @@ -12053,9 +12054,9 @@ func (x *BlindedPaymentPath) GetBaseFeeMsat() uint64 { return 0 } -func (x *BlindedPaymentPath) GetProportionalFeeMsat() uint64 { +func (x *BlindedPaymentPath) GetProportionalFeeRate() uint32 { if x != nil { - return x.ProportionalFeeMsat + return x.ProportionalFeeRate } return 0 } @@ -19611,9 +19612,9 @@ var file_lightning_proto_rawDesc = []byte{ 0x74, 0x68, 0x12, 0x22, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x4d, 0x73, 0x61, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x72, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x46, 0x65, 0x65, 0x4d, 0x73, 0x61, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x6f, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6c, 0x74, 0x76, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6c, 0x74, 0x76, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x74, 0x6c, 0x63, 0x5f, 0x6d, 0x69, 0x6e, diff --git a/lnrpc/lightning.proto b/lnrpc/lightning.proto index 079f2cddd8..644a9585db 100644 --- a/lnrpc/lightning.proto +++ b/lnrpc/lightning.proto @@ -3545,8 +3545,11 @@ message BlindedPaymentPath { // The base fee for the blinded path provided, expressed in msat. uint64 base_fee_msat = 2; - // The proportional fee for the blinded path provided, expressed in msat. - uint64 proportional_fee_msat = 3; + /* + The proportional fee for the blinded path provided, expressed in parts + per million. + */ + uint32 proportional_fee_rate = 3; /* The total CLTV delta for the blinded path provided, including the diff --git a/lnrpc/lightning.swagger.json b/lnrpc/lightning.swagger.json index 93eeb2ea4f..db5d3581ff 100644 --- a/lnrpc/lightning.swagger.json +++ b/lnrpc/lightning.swagger.json @@ -3523,10 +3523,10 @@ "format": "uint64", "description": "The base fee for the blinded path provided, expressed in msat." }, - "proportional_fee_msat": { - "type": "string", - "format": "uint64", - "description": "The proportional fee for the blinded path provided, expressed in msat." + "proportional_fee_rate": { + "type": "integer", + "format": "int64", + "description": "The proportional fee for the blinded path provided, expressed in parts\nper million." }, "total_cltv_delta": { "type": "integer", diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 5768488a34..18233991d0 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -487,15 +487,13 @@ func unmarshalBlindedPayment(rpcPayment *lnrpc.BlindedPaymentPath) ( } return &routing.BlindedPayment{ - BlindedPath: path, - CltvExpiryDelta: uint16(rpcPayment.TotalCltvDelta), - BaseFee: uint32(rpcPayment.BaseFeeMsat), - ProportionalFeeRate: uint32( - rpcPayment.ProportionalFeeMsat, - ), - HtlcMinimum: rpcPayment.HtlcMinMsat, - HtlcMaximum: rpcPayment.HtlcMaxMsat, - Features: features, + BlindedPath: path, + CltvExpiryDelta: uint16(rpcPayment.TotalCltvDelta), + BaseFee: uint32(rpcPayment.BaseFeeMsat), + ProportionalFeeRate: rpcPayment.ProportionalFeeRate, + HtlcMinimum: rpcPayment.HtlcMinMsat, + HtlcMaximum: rpcPayment.HtlcMaxMsat, + Features: features, }, nil }