multi: allow setting target confs for co-op close

This commit adds a new config option: "--coop-close-target-confs"
which allows a user to override the default target confirmations of 6
that is used to estimate a fee rate to use during a co-op closure
initiated by a remote peer.
This commit is contained in:
Elle Mouton
2021-03-02 14:11:10 +02:00
parent 660d37a335
commit 3b412ce50f
4 changed files with 24 additions and 3 deletions

View File

@@ -298,6 +298,11 @@ type Config struct {
// initiator for anchor channel commitments.
MaxAnchorsCommitFeeRate chainfee.SatPerKWeight
// CoopCloseTargetConfs is the confirmation target that will be used
// to estimate the fee rate to use during a cooperative channel
// closure initiated by the remote peer.
CoopCloseTargetConfs uint32
// ServerPubKey is the serialized, compressed public key of our lnd node.
// It is used to determine which policy (channel edge) to pass to the
// ChannelLink.
@@ -2340,9 +2345,10 @@ func (p *Brontide) fetchActiveChanCloser(chanID lnwire.ChannelID) (
}
// In order to begin fee negotiations, we'll first compute our
// target ideal fee-per-kw. We'll set this to a lax value, as
// we weren't the ones that initiated the channel closure.
feePerKw, err := p.cfg.FeeEstimator.EstimateFeePerKW(6)
// target ideal fee-per-kw.
feePerKw, err := p.cfg.FeeEstimator.EstimateFeePerKW(
p.cfg.CoopCloseTargetConfs,
)
if err != nil {
peerLog.Errorf("unable to query fee estimator: %v", err)