rpc: use default if conf-target is not set

This commit uses the new coop-close-target-confs value as the default to
use for a nodes self initiated channel closures if the conf-target flag
for the channel closure is not set. The defaults for both these options
is 6 so this shouldnt change current behaviour.
This commit is contained in:
Elle Mouton committed 2021-03-04 13:07:30 +02:00
1 parent 3b412ce50f
commit 9e9c48fcdd
3 files changed
+14 -3

No files matched your search

+8 -1
View File
@@ -2317,6 +2317,13 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
"is offline (try force closing it instead): %v", err)
}
// If conf-target is not set then use the conf-target used for
// co-op closes that are initiated by the remote peer.
targetConf := uint32(in.TargetConf)
if targetConf == 0 {
targetConf = r.cfg.CoopCloseTargetConfs
}
// Based on the passed fee related parameters, we'll determine
// an appropriate fee rate for the cooperative closure
// transaction.
@@ -2325,7 +2332,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
).FeePerKWeight()
feeRate, err := sweep.DetermineFeePerKw(
r.server.cc.FeeEstimator, sweep.FeePreference{
ConfTarget: uint32(in.TargetConf),
ConfTarget: targetConf,
FeeRate: satPerKw,
},
)