From 61f79d890cda3ab4b936b25d45ae594ebaeca560 Mon Sep 17 00:00:00 2001 From: Alex Bosworth Date: Fri, 19 Mar 2021 18:43:07 -0700 Subject: [PATCH 1/2] rpcserver: revert target conf to previous behavior Previously the rpcserver would not use the remote conf target as its local conf target and this behavior is desirable. --- rpcserver.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 42e2a17b..953b46b0 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2168,13 +2168,6 @@ 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. @@ -2183,7 +2176,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest, ).FeePerKWeight() feeRate, err := sweep.DetermineFeePerKw( r.server.cc.FeeEstimator, sweep.FeePreference{ - ConfTarget: targetConf, + ConfTarget: uint32(in.TargetConf), FeeRate: satPerKw, }, ) From 069de381860c5c58c649d36c60451b3445cca349 Mon Sep 17 00:00:00 2001 From: Alex Bosworth Date: Mon, 22 Mar 2021 13:08:38 -0700 Subject: [PATCH 2/2] itest: add support for specifying chain fee rate --- lntest/harness.go | 5 +++++ lntest/itest/lnd_test.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lntest/harness.go b/lntest/harness.go index b54234da..03462b8d 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -845,6 +845,10 @@ type OpenChannelParams struct { // FundingShim is an optional funding shim that the caller can specify // in order to modify the channel funding workflow. FundingShim *lnrpc.FundingShim + + // SatPerVByte is the amount of satoshis to spend in chain fees per virtual + // byte of the transaction. + SatPerVByte btcutil.Amount } // OpenChannel attempts to open a channel between srcNode and destNode with the @@ -882,6 +886,7 @@ func (n *NetworkHarness) OpenChannel(ctx context.Context, MinHtlcMsat: int64(p.MinHtlc), RemoteMaxHtlcs: uint32(p.RemoteMaxHtlcs), FundingShim: p.FundingShim, + SatPerByte: int64(p.SatPerVByte), } respStream, err := srcNode.OpenChannel(ctx, openReq) diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 1e79370a..c29f60e9 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -1253,6 +1253,7 @@ func basicChannelFundingTest(t *harnessTest, net *lntest.NetworkHarness, chanAmt := funding.MaxBtcFundingAmount pushAmt := btcutil.Amount(100000) + satPerVbyte := btcutil.Amount(1) // Record nodes' channel balance before testing. aliceChannelBalance := getChannelBalance(t, alice) @@ -1293,6 +1294,7 @@ func basicChannelFundingTest(t *harnessTest, net *lntest.NetworkHarness, Amt: chanAmt, PushAmt: pushAmt, FundingShim: fundingShim, + SatPerVByte: satPerVbyte, }, )