Skip to content

Commit d1583a7

Browse files
committed
itest: add test for walletrpc.EstimateFee
Make sure conf_target=1 is accepted, but conf_target=0 is not.
1 parent c85e6f4 commit d1583a7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

itest/list_on_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,10 @@ var allTestCases = []*lntest.TestCase{
723723
Name: "grpc not found",
724724
TestFunc: testGRPCNotFound,
725725
},
726+
{
727+
Name: "estimate fee",
728+
TestFunc: testEstimateFee,
729+
},
726730
}
727731

728732
// appendPrefixed is used to add a prefix to each test name in the subtests

itest/lnd_misc_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package itest
22

33
import (
4+
"context"
45
"encoding/hex"
56
"fmt"
67
"os"
@@ -1391,3 +1392,25 @@ func testGRPCNotFound(ht *lntest.HarnessTest) {
13911392
RHash: rHash,
13921393
}, notFoundErr)
13931394
}
1395+
1396+
// testEstimateFee tests walletrpc.EstimateFee API.
1397+
func testEstimateFee(ht *lntest.HarnessTest) {
1398+
alice := ht.NewNode("Alice", nil)
1399+
1400+
ctx := context.Background()
1401+
1402+
// Make sure it passes with conf_target=1.
1403+
req := &walletrpc.EstimateFeeRequest{
1404+
ConfTarget: 1,
1405+
}
1406+
resp, err := alice.RPC.WalletKit.EstimateFee(ctx, req)
1407+
require.NoError(ht, err)
1408+
require.NotZero(ht, resp.SatPerKw)
1409+
require.NotZero(ht, resp.MinRelayFeeSatPerKw)
1410+
1411+
// Make sure it fails with conf_target=0.
1412+
req.ConfTarget = 0
1413+
_, err = alice.RPC.WalletKit.EstimateFee(ctx, req)
1414+
require.ErrorContains(ht, err, "confirmation target must be greater "+
1415+
"than 0")
1416+
}

0 commit comments

Comments
 (0)