lnrpc+lncli: adds required reserve rpc & cli
This commit is contained in:
1 parent
8578433b3d
commit
3befeadaf3
11 files changed
+992
-558
No files matched your search
@@ -66,6 +66,7 @@ func walletCommands() []cli.Command {
|
||||
listLeasesCommand,
|
||||
psbtCommand,
|
||||
accountsCommand,
|
||||
requiredReserveCommand,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1083,6 +1084,53 @@ func listAccounts(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var requiredReserveCommand = cli.Command{
|
||||
Name: "requiredreserve",
|
||||
Usage: "Returns the wallet reserve.",
|
||||
Description: `
|
||||
Returns the minimum amount of satoshis that should be kept in the
|
||||
wallet in order to fee bump anchor channels if necessary. The value
|
||||
scales with the number of public anchor channels but is capped at
|
||||
a maximum.
|
||||
|
||||
Use the flag --additional_channels to get the reserve value based
|
||||
on the additional channels you would like to open.
|
||||
`,
|
||||
Flags: []cli.Flag{
|
||||
cli.Uint64Flag{
|
||||
Name: "additional_channels",
|
||||
Usage: "(optional) specify the additional public channels " +
|
||||
"that you would like to open",
|
||||
},
|
||||
},
|
||||
Action: actionDecorator(requiredReserve),
|
||||
}
|
||||
|
||||
func requiredReserve(ctx *cli.Context) error {
|
||||
ctxc := getContext()
|
||||
|
||||
// Display the command's help message if we do not have the expected
|
||||
// number of arguments/flags.
|
||||
if ctx.NArg() > 0 || ctx.NumFlags() > 1 {
|
||||
return cli.ShowCommandHelp(ctx, "requiredreserve")
|
||||
}
|
||||
|
||||
walletClient, cleanUp := getWalletClient(ctx)
|
||||
defer cleanUp()
|
||||
|
||||
req := &walletrpc.RequiredReserveRequest{
|
||||
AdditionalPublicChannels: uint32(ctx.Uint64("additional_channels")),
|
||||
}
|
||||
resp, err := walletClient.RequiredReserve(ctxc, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(resp)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var importAccountCommand = cli.Command{
|
||||
Name: "import",
|
||||
Usage: "Import an on-chain account into the wallet through its " +
|
||||
|
||||
Reference in new issue
Block a user