mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 18:01:57 +01:00
lncli: use routerrpc for payments
This commit is contained in:
@@ -2380,7 +2380,7 @@ func queryRoutes(ctx *cli.Context) error {
|
||||
return fmt.Errorf("amt argument missing")
|
||||
}
|
||||
|
||||
feeLimit, err := retrieveFeeLimit(ctx)
|
||||
feeLimit, err := retrieveFeeLimitLegacy(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -2403,6 +2403,38 @@ func queryRoutes(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// retrieveFeeLimitLegacy retrieves the fee limit based on the different fee
|
||||
// limit flags passed. This function will eventually disappear in favor of
|
||||
// retrieveFeeLimit and the new payment rpc.
|
||||
func retrieveFeeLimitLegacy(ctx *cli.Context) (*lnrpc.FeeLimit, error) {
|
||||
switch {
|
||||
case ctx.IsSet("fee_limit") && ctx.IsSet("fee_limit_percent"):
|
||||
return nil, fmt.Errorf("either fee_limit or fee_limit_percent " +
|
||||
"can be set, but not both")
|
||||
case ctx.IsSet("fee_limit"):
|
||||
return &lnrpc.FeeLimit{
|
||||
Limit: &lnrpc.FeeLimit_Fixed{
|
||||
Fixed: ctx.Int64("fee_limit"),
|
||||
},
|
||||
}, nil
|
||||
case ctx.IsSet("fee_limit_percent"):
|
||||
feeLimitPercent := ctx.Int64("fee_limit_percent")
|
||||
if feeLimitPercent < 0 {
|
||||
return nil, errors.New("negative fee limit percentage " +
|
||||
"provided")
|
||||
}
|
||||
return &lnrpc.FeeLimit{
|
||||
Limit: &lnrpc.FeeLimit_Percent{
|
||||
Percent: feeLimitPercent,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Since the fee limit flags aren't required, we don't return an error
|
||||
// if they're not set.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var getNetworkInfoCommand = cli.Command{
|
||||
Name: "getnetworkinfo",
|
||||
Category: "Channels",
|
||||
|
||||
Reference in New Issue
Block a user