@@ -173,32 +173,40 @@ func testMinRelayFeeBump(t *harnessTest) {
173173 SetNodeUTXOs (t , t .lndHarness .Alice , btcutil .Amount (1 ), initialUTXOs )
174174 defer ResetNodeWallet (t , t .lndHarness .Alice )
175175
176- // Set the min relay fee to a higher value than the fee rate that will
177- // be returned by the fee estimation.
178- lowFeeRate := chainfee .SatPerVByte ( 1 ).FeePerKWeight ()
179- highMinRelayFeeRate := chainfee .SatPerVByte ( 2 ). FeePerKVByte ( )
180- defaultMinRelayFeeRate := chainfee .SatPerVByte ( 1 ). FeePerKVByte ( )
176+ // Set the variables for the fee rates we'll use in this test.
177+ belowFloorFeeRate := chainfee . SatPerVByte ( 1 ). FeePerKWeight ()
178+ belowMinRelayFeeRate := chainfee .SatPerKVByte ( 1500 ).FeePerKWeight ()
179+ realWorldMinRelayFeeRate := chainfee .SatPerKVByte ( 1952 )
180+ harnessMinRelayFeeRate := chainfee .SatPerKVByte ( 1000 )
181181 defaultFeeRate := chainfee .SatPerKWeight (3125 )
182- t .lndHarness .SetFeeEstimateWithConf (lowFeeRate , 6 )
183- t .lndHarness .SetMinRelayFeerate (highMinRelayFeeRate )
182+
183+ // roundUpMinRelayFeeRate is the converted fee rate to sat/vbyte as
184+ // that's what the FundPsbt expects. We add 999 to round up to the
185+ // nearest 1000. We'll use this with `AssertFeerate`.
186+ roundUpMinRelayFeeRate := chainfee .SatPerVByte (
187+ (realWorldMinRelayFeeRate + 999 ) / 1000 ,
188+ )
189+
190+ t .lndHarness .SetFeeEstimateWithConf (belowFloorFeeRate , 6 )
191+ t .lndHarness .SetMinRelayFeerate (realWorldMinRelayFeeRate )
184192
185193 // Reset all fee rates to their default value at the end of this test.
186- defer t .lndHarness .SetMinRelayFeerate (defaultMinRelayFeeRate )
194+ defer t .lndHarness .SetMinRelayFeerate (harnessMinRelayFeeRate )
187195 defer t .lndHarness .SetFeeEstimateWithConf (defaultFeeRate , 6 )
188196
189197 // First, we'll make a normal assets with enough units to allow us to
190198 // send it around a few times.
191199 MintAssetsConfirmBatch (
192200 t .t , t .lndHarness .Miner ().Client , t .tapd ,
193201 []* mintrpc.MintAssetRequest {issuableAssets [0 ]},
194- WithFeeRate (uint32 (lowFeeRate )),
202+ WithFeeRate (uint32 (belowFloorFeeRate )),
195203 WithError ("manual fee rate below floor" ),
196204 )
197205
198206 MintAssetsConfirmBatch (
199207 t .t , t .lndHarness .Miner ().Client , t .tapd ,
200208 []* mintrpc.MintAssetRequest {issuableAssets [0 ]},
201- WithFeeRate (uint32 (lowFeeRate ) + 10 ),
209+ WithFeeRate (uint32 (belowMinRelayFeeRate ) ),
202210 WithError ("feerate does not meet minrelayfee" ),
203211 )
204212
@@ -217,7 +225,7 @@ func testMinRelayFeeBump(t *harnessTest) {
217225 // We check whether the minting TX is bumped to the min relay fee.
218226 AssertFeeRate (
219227 t .t , t .lndHarness .Miner ().Client , initialUTXOs [0 ].Amount ,
220- & mintOutpoint .Hash , highMinRelayFeeRate .FeePerKWeight (),
228+ & mintOutpoint .Hash , roundUpMinRelayFeeRate .FeePerKWeight (),
221229 )
222230
223231 // Now that we have the asset created, we'll make a new node that'll
@@ -250,13 +258,13 @@ func testMinRelayFeeBump(t *harnessTest) {
250258
251259 sendAsset (
252260 t , t .tapd , withReceiverAddresses (bobAddr ),
253- withFeeRate (uint32 (lowFeeRate )),
261+ withFeeRate (uint32 (belowFloorFeeRate )),
254262 withError ("manual fee rate below floor" ),
255263 )
256264
257265 sendAsset (
258266 t , t .tapd , withReceiverAddresses (bobAddr ),
259- withFeeRate (uint32 (lowFeeRate ) + 10 ),
267+ withFeeRate (uint32 (belowMinRelayFeeRate ) ),
260268 withError ("feerate does not meet minrelayfee" ),
261269 )
262270
@@ -271,7 +279,7 @@ func testMinRelayFeeBump(t *harnessTest) {
271279 sendInputAmt := initialUTXOs [1 ].Amount + 1000
272280 AssertTransferFeeRate (
273281 t .t , t .lndHarness .Miner ().Client , sendResp , sendInputAmt ,
274- highMinRelayFeeRate .FeePerKWeight (),
282+ roundUpMinRelayFeeRate .FeePerKWeight (),
275283 )
276284
277285 AssertNonInteractiveRecvComplete (t .t , secondTapd , 1 )
0 commit comments