Skip to content

Commit

Permalink
lnrpc: rename proportional fee rate on lnrpc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
carlaKC committed Mar 27, 2024
1 parent 0aeb7c4 commit 4214330
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cmd/lncli/cmd_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)),
Expand Down
15 changes: 8 additions & 7 deletions lnrpc/lightning.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lnrpc/lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lnrpc/lightning.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 7 additions & 9 deletions lnrpc/routerrpc/router_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 4214330

Please sign in to comment.