Merge pull request #5064 from ellemouton/set-coop-close-target-confs

multi: allow setting target confs for co-op close
This commit is contained in:
Conner Fromknecht
2021-03-16 11:14:15 -07:00
committed by GitHub
6 changed files with 37 additions and 5 deletions

View File

@ -2163,6 +2163,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.
@ -2171,7 +2178,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,
},
)