@@ -173,32 +173,40 @@ func testMinRelayFeeBump(t *harnessTest) {
173
173
SetNodeUTXOs (t , t .lndHarness .Alice , btcutil .Amount (1 ), initialUTXOs )
174
174
defer ResetNodeWallet (t , t .lndHarness .Alice )
175
175
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 )
181
181
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 )
184
192
185
193
// 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 )
187
195
defer t .lndHarness .SetFeeEstimateWithConf (defaultFeeRate , 6 )
188
196
189
197
// First, we'll make a normal assets with enough units to allow us to
190
198
// send it around a few times.
191
199
MintAssetsConfirmBatch (
192
200
t .t , t .lndHarness .Miner ().Client , t .tapd ,
193
201
[]* mintrpc.MintAssetRequest {issuableAssets [0 ]},
194
- WithFeeRate (uint32 (lowFeeRate )),
202
+ WithFeeRate (uint32 (belowFloorFeeRate )),
195
203
WithError ("manual fee rate below floor" ),
196
204
)
197
205
198
206
MintAssetsConfirmBatch (
199
207
t .t , t .lndHarness .Miner ().Client , t .tapd ,
200
208
[]* mintrpc.MintAssetRequest {issuableAssets [0 ]},
201
- WithFeeRate (uint32 (lowFeeRate ) + 10 ),
209
+ WithFeeRate (uint32 (belowMinRelayFeeRate ) ),
202
210
WithError ("feerate does not meet minrelayfee" ),
203
211
)
204
212
@@ -217,7 +225,7 @@ func testMinRelayFeeBump(t *harnessTest) {
217
225
// We check whether the minting TX is bumped to the min relay fee.
218
226
AssertFeeRate (
219
227
t .t , t .lndHarness .Miner ().Client , initialUTXOs [0 ].Amount ,
220
- & mintOutpoint .Hash , highMinRelayFeeRate .FeePerKWeight (),
228
+ & mintOutpoint .Hash , roundUpMinRelayFeeRate .FeePerKWeight (),
221
229
)
222
230
223
231
// Now that we have the asset created, we'll make a new node that'll
@@ -250,13 +258,13 @@ func testMinRelayFeeBump(t *harnessTest) {
250
258
251
259
sendAsset (
252
260
t , t .tapd , withReceiverAddresses (bobAddr ),
253
- withFeeRate (uint32 (lowFeeRate )),
261
+ withFeeRate (uint32 (belowFloorFeeRate )),
254
262
withError ("manual fee rate below floor" ),
255
263
)
256
264
257
265
sendAsset (
258
266
t , t .tapd , withReceiverAddresses (bobAddr ),
259
- withFeeRate (uint32 (lowFeeRate ) + 10 ),
267
+ withFeeRate (uint32 (belowMinRelayFeeRate ) ),
260
268
withError ("feerate does not meet minrelayfee" ),
261
269
)
262
270
@@ -271,7 +279,7 @@ func testMinRelayFeeBump(t *harnessTest) {
271
279
sendInputAmt := initialUTXOs [1 ].Amount + 1000
272
280
AssertTransferFeeRate (
273
281
t .t , t .lndHarness .Miner ().Client , sendResp , sendInputAmt ,
274
- highMinRelayFeeRate .FeePerKWeight (),
282
+ roundUpMinRelayFeeRate .FeePerKWeight (),
275
283
)
276
284
277
285
AssertNonInteractiveRecvComplete (t .t , secondTapd , 1 )
0 commit comments