mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
Merge pull request #8350 from ziggie1984/rename-bumpclosefee
Minor improvements in the lncli api regarding channel closures.
This commit is contained in:
@@ -756,7 +756,10 @@ var closeChannelCommand = cli.Command{
|
||||
In the case of a cooperative closure, one can manually set the fee to
|
||||
be used for the closing transaction via either the --conf_target or
|
||||
--sat_per_vbyte arguments. This will be the starting value used during
|
||||
fee negotiation. This is optional.
|
||||
fee negotiation. This is optional. The parameter --max_fee_rate in
|
||||
comparison is the end boundary of the fee negotiation, if not specified
|
||||
it's always x3 of the starting value. Increasing this value increases
|
||||
the chance of a successful negotiation.
|
||||
|
||||
In the case of a cooperative closure, one can manually set the address
|
||||
to deliver funds to upon closure. This is optional, and may only be used
|
||||
@@ -808,7 +811,8 @@ var closeChannelCommand = cli.Command{
|
||||
Name: "sat_per_vbyte",
|
||||
Usage: "(optional) a manual fee expressed in " +
|
||||
"sat/vbyte that should be used when crafting " +
|
||||
"the transaction",
|
||||
"the transaction; default is a conf-target " +
|
||||
"of 6 blocks",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "delivery_addr",
|
||||
@@ -817,6 +821,14 @@ var closeChannelCommand = cli.Command{
|
||||
"be used if an upfront shutdown address is not " +
|
||||
"already set",
|
||||
},
|
||||
cli.Uint64Flag{
|
||||
Name: "max_fee_rate",
|
||||
Usage: "(optional) maximum fee rate in sat/vbyte " +
|
||||
"accepted during the negotiation (default is " +
|
||||
"x3 of the desired fee rate); increases the " +
|
||||
"success pobability of the negotiation if " +
|
||||
"set higher",
|
||||
},
|
||||
},
|
||||
Action: actionDecorator(closeChannel),
|
||||
}
|
||||
@@ -853,6 +865,7 @@ func closeChannel(ctx *cli.Context) error {
|
||||
TargetConf: int32(ctx.Int64("conf_target")),
|
||||
SatPerVbyte: ctx.Uint64(feeRateFlag),
|
||||
DeliveryAddress: ctx.String("delivery_addr"),
|
||||
MaxFeePerVbyte: ctx.Uint64("max_fee_rate"),
|
||||
}
|
||||
|
||||
// After parsing the request, we'll spin up a goroutine that will
|
||||
|
||||
@@ -71,6 +71,7 @@ func walletCommands() []cli.Command {
|
||||
pendingSweepsCommand,
|
||||
bumpFeeCommand,
|
||||
bumpCloseFeeCommand,
|
||||
bumpForceCloseFeeCommand,
|
||||
listSweepsCommand,
|
||||
labelTxCommand,
|
||||
publishTxCommand,
|
||||
@@ -266,14 +267,19 @@ func bumpFee(ctx *cli.Context) error {
|
||||
|
||||
var bumpCloseFeeCommand = cli.Command{
|
||||
Name: "bumpclosefee",
|
||||
Usage: "Bumps the fee of a channel closing transaction.",
|
||||
Usage: "Bumps the fee of a channel force closing transaction.",
|
||||
ArgsUsage: "channel_point",
|
||||
Hidden: true,
|
||||
Description: `
|
||||
This command allows the fee of a channel closing transaction to be
|
||||
increased by using the child-pays-for-parent mechanism. It will instruct
|
||||
the sweeper to sweep the anchor outputs of transactions in the set
|
||||
of valid commitments for the specified channel at the requested fee
|
||||
rate or confirmation target.
|
||||
This command works only for unilateral closes of anchor channels. It
|
||||
allows the fee of a channel force closing transaction to be increased by
|
||||
using the child-pays-for-parent mechanism. It will instruct the sweeper
|
||||
to sweep the anchor outputs of the closing transaction at the requested
|
||||
fee rate or confirmation target. The specified fee rate will be the
|
||||
effective fee rate taking the parent fee into account.
|
||||
Depending on the sweeper configuration (batchwindowduration) the sweeptx
|
||||
will not be published immediately.
|
||||
NOTE: This cmd is DEPRECATED please use bumpforceclosefee instead.
|
||||
`,
|
||||
Flags: []cli.Flag{
|
||||
cli.Uint64Flag{
|
||||
@@ -292,10 +298,44 @@ var bumpCloseFeeCommand = cli.Command{
|
||||
"should be used when sweeping the output",
|
||||
},
|
||||
},
|
||||
Action: actionDecorator(bumpCloseFee),
|
||||
Action: actionDecorator(bumpForceCloseFee),
|
||||
}
|
||||
|
||||
func bumpCloseFee(ctx *cli.Context) error {
|
||||
var bumpForceCloseFeeCommand = cli.Command{
|
||||
Name: "bumpforceclosefee",
|
||||
Usage: "Bumps the fee of a channel force closing transaction.",
|
||||
ArgsUsage: "channel_point",
|
||||
Description: `
|
||||
This command works only for unilateral closes of anchor channels. It
|
||||
allows the fee of a channel force closing transaction to be increased by
|
||||
using the child-pays-for-parent mechanism. It will instruct the sweeper
|
||||
to sweep the anchor outputs of the closing transaction at the requested
|
||||
fee rate or confirmation target. The specified fee rate will be the
|
||||
effective fee rate taking the parent fee into account.
|
||||
Depending on the sweeper configuration (batchwindowduration) the sweeptx
|
||||
will not be published immediately.
|
||||
`,
|
||||
Flags: []cli.Flag{
|
||||
cli.Uint64Flag{
|
||||
Name: "conf_target",
|
||||
Usage: "the number of blocks that the output should " +
|
||||
"be swept on-chain within",
|
||||
},
|
||||
cli.Uint64Flag{
|
||||
Name: "sat_per_byte",
|
||||
Usage: "Deprecated, use sat_per_vbyte instead.",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.Uint64Flag{
|
||||
Name: "sat_per_vbyte",
|
||||
Usage: "a manual fee expressed in sat/vbyte that " +
|
||||
"should be used when sweeping the output",
|
||||
},
|
||||
},
|
||||
Action: actionDecorator(bumpForceCloseFee),
|
||||
}
|
||||
|
||||
func bumpForceCloseFee(ctx *cli.Context) error {
|
||||
ctxc := getContext()
|
||||
|
||||
// Display the command's help message if we do not have the expected
|
||||
@@ -368,19 +408,20 @@ func bumpCloseFee(ctx *cli.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
// Bump fee of the anchor sweep.
|
||||
fmt.Printf("Bumping fee of %v:%v\n",
|
||||
sweepTxID, sweep.Outpoint.OutputIndex)
|
||||
|
||||
_, err = walletClient.BumpFee(ctxc, &walletrpc.BumpFeeRequest{
|
||||
Outpoint: sweep.Outpoint,
|
||||
TargetConf: uint32(ctx.Uint64("conf_target")),
|
||||
SatPerVbyte: ctx.Uint64(feeRateFlag),
|
||||
Force: true,
|
||||
})
|
||||
resp, err := walletClient.BumpFee(
|
||||
ctxc, &walletrpc.BumpFeeRequest{
|
||||
Outpoint: sweep.Outpoint,
|
||||
TargetConf: uint32(ctx.Uint64("conf_target")),
|
||||
SatPerVbyte: ctx.Uint64(feeRateFlag),
|
||||
Force: true,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Bump fee of the anchor sweep.
|
||||
fmt.Printf("Bumping fee of %v:%v: %v\n",
|
||||
sweepTxID, sweep.Outpoint.OutputIndex, resp.GetStatus())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user