@@ -19,6 +19,7 @@ import (
1919 "github.com/lightningnetwork/lnd/lnrpc/signrpc"
2020 "github.com/lightningnetwork/lnd/lntest"
2121 "github.com/lightningnetwork/lnd/lntest/node"
22+ "github.com/lightningnetwork/lnd/lnwallet/chainfee"
2223 "github.com/lightningnetwork/lnd/lnwire"
2324 "github.com/stretchr/testify/require"
2425)
@@ -968,11 +969,16 @@ func testBatchChanFunding(ht *lntest.HarnessTest) {
968969 ht .EnsureConnected (alice , dave )
969970 ht .EnsureConnected (alice , eve )
970971
972+ expectedFeeRate := chainfee .SatPerKWeight (2500 )
973+
974+ // We verify that the channel opening uses the correct fee rate.
975+ ht .SetFeeEstimateWithConf (expectedFeeRate , 3 )
976+
971977 // Let's create our batch TX request. This first one should fail as we
972978 // open a channel to Carol that is too small for her min chan size.
973979 batchReq := & lnrpc.BatchOpenChannelRequest {
974- SatPerVbyte : 12 ,
975- MinConfs : 1 ,
980+ TargetConf : 3 ,
981+ MinConfs : 1 ,
976982 Channels : []* lnrpc.BatchOpenChannel {{
977983 NodePubkey : bob .PubKey [:],
978984 LocalFundingAmount : 100_000 ,
@@ -1069,6 +1075,12 @@ func testBatchChanFunding(ht *lntest.HarnessTest) {
10691075 rawTx := ht .GetRawTransaction (txHash )
10701076 require .Len (ht , rawTx .MsgTx ().TxOut , 5 )
10711077
1078+ // Check the fee rate of the batch-opening transaction. We expect slight
1079+ // inaccuracies because of the DER signature fee estimation.
1080+ openingFeeRate := ht .CalculateTxFeeRate (rawTx .MsgTx ())
1081+ require .InEpsilonf (ht , uint64 (expectedFeeRate ), uint64 (openingFeeRate ),
1082+ 0.01 , "want %v, got %v" , expectedFeeRate , openingFeeRate )
1083+
10721084 // For calculating the change output index we use the formula for the
10731085 // sum of consecutive of integers (n(n+1)/2). All the channel point
10741086 // indexes are known, so we just calculate the difference to get the
0 commit comments