Skip to content

Commit f308629

Browse files
authored
Merge pull request #892 from lightninglabs/validate-fee
Add itest for MinRelayFee check in tapd
2 parents 3a8f1f6 + 13fa097 commit f308629

File tree

6 files changed

+136
-7
lines changed

6 files changed

+136
-7
lines changed

cmd/litcli/ln.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ var fundChannelCommand = cli.Command{
6464
Usage: "(optional) a manual fee expressed in " +
6565
"sat/vByte that should be used when crafting " +
6666
"the transaction",
67-
Value: 1,
6867
},
6968
cli.Uint64Flag{
7069
Name: "push_amt",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Release Notes
2+
3+
- [Lightning Terminal](#lightning-terminal)
4+
- [Bug Fixes](#bug-fixes)
5+
- [Functional Changes/Additions](#functional-changesadditions)
6+
- [Technical and Architectural Updates](#technical-and-architectural-updates)
7+
- [Integrated Binary Updates](#integrated-binary-updates)
8+
- [LND](#lnd)
9+
- [Loop](#loop)
10+
- [Pool](#pool)
11+
- [Faraday](#faraday)
12+
- [Taproot Assets](#taproot-assets)
13+
- [Contributors](#contributors-alphabetical-order)
14+
15+
## Lightning Terminal
16+
17+
### Bug Fixes
18+
19+
### Functional Changes/Additions
20+
21+
* [Add itest](https://github.com/lightninglabs/lightning-terminal/pull/892) for
22+
the MinRelayFee check added in Taproot Assets. The test ensures that
23+
transactions with fees below the minimum relay fee are rejected.
24+
25+
### Technical and Architectural Updates
26+
27+
## Integrated Binary Updates
28+
29+
### LND
30+
31+
### Loop
32+
33+
### Pool
34+
35+
### Faraday
36+
37+
### Taproot Assets
38+
39+
40+
41+
# Contributors (Alphabetical Order)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ require (
1616
github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee4e7ff52f83
1717
github.com/lightninglabs/lightning-terminal/autopilotserverrpc v0.0.1
1818
github.com/lightninglabs/lightning-terminal/litrpc v1.0.0
19-
github.com/lightninglabs/lndclient v0.18.4-1
19+
github.com/lightninglabs/lndclient v0.18.4-3
2020
github.com/lightninglabs/loop v0.28.8-beta.0.20241022072406-1e8ae31ddc27
2121
github.com/lightninglabs/loop/looprpc v1.0.0
2222
github.com/lightninglabs/loop/swapserverrpc v1.0.10
2323
github.com/lightninglabs/pool v0.6.5-beta.0.20241015105339-044cb451b5df
2424
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
2525
github.com/lightninglabs/pool/poolrpc v1.0.0
26-
github.com/lightninglabs/taproot-assets v0.4.2-0.20241031160301-588e58bfae6c
26+
github.com/lightninglabs/taproot-assets v0.4.2-0.20241101220611-e6b78bd51722
2727
github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241025090009-615f3d633e61
2828
github.com/lightningnetwork/lnd/cert v1.2.2
2929
github.com/lightningnetwork/lnd/fn v1.2.3

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,8 +1157,8 @@ github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee
11571157
github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee4e7ff52f83/go.mod h1:+SasPOt0evcJdfApb/ALTaTz4x3a2/kWy5KqFoTpiX8=
11581158
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY=
11591159
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4=
1160-
github.com/lightninglabs/lndclient v0.18.4-1 h1:k2UnxHGNH243NRe5/dL2sKgrxc8WMHbFQRdnCtfilwc=
1161-
github.com/lightninglabs/lndclient v0.18.4-1/go.mod h1:/HLqmZGL9MtP8F1g+laq+L9VrsugBN5tsTct3C5wWCg=
1160+
github.com/lightninglabs/lndclient v0.18.4-3 h1:Xk3ZuCQE4ZlF70jaToryL2MvRcryiE0zTfUjJbmzUBY=
1161+
github.com/lightninglabs/lndclient v0.18.4-3/go.mod h1:/HLqmZGL9MtP8F1g+laq+L9VrsugBN5tsTct3C5wWCg=
11621162
github.com/lightninglabs/loop v0.28.8-beta.0.20241022072406-1e8ae31ddc27 h1:eZBvG9XvDL0zsUIqFfD7SCk+Ex8rGWEL8j5UQ/aqjco=
11631163
github.com/lightninglabs/loop v0.28.8-beta.0.20241022072406-1e8ae31ddc27/go.mod h1:4B1DqrcOc5Yv9KyclAeQJY9Ah9UMX7RpI4Uru7aEzl4=
11641164
github.com/lightninglabs/loop/looprpc v1.0.0 h1:xry4QPCZShPww660xJm1BVcNFj8etgNeN2vMpfsv3c4=
@@ -1177,8 +1177,8 @@ github.com/lightninglabs/pool/poolrpc v1.0.0 h1:vvosrgNx9WXF4mcHGqLjZOW8wNM0q+BL
11771177
github.com/lightninglabs/pool/poolrpc v1.0.0/go.mod h1:ZqpEpBFRMMBAerMmilEjh27tqauSXDwLaLR0O3jvmMA=
11781178
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9Z6CpKxl13mS48idsu6F+cEZf0lkyiV+Dq9g=
11791179
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
1180-
github.com/lightninglabs/taproot-assets v0.4.2-0.20241031160301-588e58bfae6c h1:HfU82bWD4Yk+Mf2Ax25uhcIwq0SxToTq8J8YJLReW/U=
1181-
github.com/lightninglabs/taproot-assets v0.4.2-0.20241031160301-588e58bfae6c/go.mod h1:AYq9p1FOMdwAGjEjVaT79+cDyAwcc4fj8W0YJvCU0JE=
1180+
github.com/lightninglabs/taproot-assets v0.4.2-0.20241101220611-e6b78bd51722 h1:67uNN65L8P6rcTkFAAuD+oYldQcDkSQLGK+o4Cfu/X8=
1181+
github.com/lightninglabs/taproot-assets v0.4.2-0.20241101220611-e6b78bd51722/go.mod h1:DLcxQrwsLSXLTMNr1hBY5+pJSxNJYqobPqxhflYYFp8=
11821182
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY=
11831183
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
11841184
github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241025090009-615f3d633e61 h1:EcBM2tz+iyspYRFaDVjUe5a2bkuBWFxOWD2mzdCraUc=

itest/litd_custom_channels_test.go

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/lightningnetwork/lnd/lntest"
2828
"github.com/lightningnetwork/lnd/lntest/port"
2929
"github.com/lightningnetwork/lnd/lntest/wait"
30+
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
3031
"github.com/lightningnetwork/lnd/lnwire"
3132
"github.com/stretchr/testify/require"
3233
)
@@ -2637,3 +2638,87 @@ func testCustomChannelsOraclePricing(_ context.Context,
26372638
noOpCoOpCloseBalanceCheck,
26382639
)
26392640
}
2641+
2642+
// testCustomChannelsFee tests the whether the custom channel funding process
2643+
// fails if the proposed fee rate is lower than the minimum relay fee.
2644+
func testCustomChannelsFee(_ context.Context,
2645+
net *NetworkHarness, t *harnessTest) {
2646+
2647+
ctxb := context.Background()
2648+
lndArgs := slices.Clone(lndArgsTemplate)
2649+
litdArgs := slices.Clone(litdArgsTemplate)
2650+
2651+
zane, err := net.NewNode(
2652+
t.t, "Zane", lndArgs, false, true, litdArgs...,
2653+
)
2654+
require.NoError(t.t, err)
2655+
2656+
litdArgs = append(litdArgs, fmt.Sprintf(
2657+
"--taproot-assets.proofcourieraddr=%s://%s",
2658+
proof.UniverseRpcCourierType, zane.Cfg.LitAddr(),
2659+
))
2660+
2661+
charlie, err := net.NewNode(
2662+
t.t, "Charlie", lndArgs, false, true, litdArgs...,
2663+
)
2664+
require.NoError(t.t, err)
2665+
dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...)
2666+
require.NoError(t.t, err)
2667+
2668+
nodes := []*HarnessNode{charlie, dave}
2669+
connectAllNodes(t.t, net, nodes)
2670+
fundAllNodes(t.t, net, nodes)
2671+
2672+
charlieTap := newTapClient(t.t, charlie)
2673+
daveTap := newTapClient(t.t, dave)
2674+
2675+
// Mint an assets on Charlie and sync Dave to Charlie as the universe.
2676+
mintedAssets := itest.MintAssetsConfirmBatch(
2677+
t.t, t.lndHarness.Miner.Client, charlieTap,
2678+
[]*mintrpc.MintAssetRequest{
2679+
{
2680+
Asset: itestAsset,
2681+
},
2682+
},
2683+
)
2684+
cents := mintedAssets[0]
2685+
assetID := cents.AssetGenesis.AssetId
2686+
2687+
t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount)
2688+
syncUniverses(t.t, charlieTap, dave)
2689+
t.Logf("Universes synced between all nodes, distributing assets...")
2690+
2691+
// Fund a channel with a fee rate of zero.
2692+
zeroFeeRate := uint32(0)
2693+
2694+
_, err = charlieTap.FundChannel(
2695+
ctxb, &tchrpc.FundChannelRequest{
2696+
AssetAmount: cents.Amount,
2697+
AssetId: assetID,
2698+
PeerPubkey: daveTap.node.PubKey[:],
2699+
FeeRateSatPerVbyte: zeroFeeRate,
2700+
PushSat: 0,
2701+
},
2702+
)
2703+
2704+
errSpecifyFeerate := "fee rate must be specified"
2705+
require.ErrorContains(t.t, err, errSpecifyFeerate)
2706+
2707+
// Fund a channel with a fee rate that is too low.
2708+
tooLowFeeRate := uint32(1)
2709+
tooLowFeeRateAmount := chainfee.SatPerVByte(tooLowFeeRate)
2710+
2711+
_, err = charlieTap.FundChannel(
2712+
ctxb, &tchrpc.FundChannelRequest{
2713+
AssetAmount: cents.Amount,
2714+
AssetId: assetID,
2715+
PeerPubkey: daveTap.node.PubKey[:],
2716+
FeeRateSatPerVbyte: tooLowFeeRate,
2717+
PushSat: 0,
2718+
},
2719+
)
2720+
2721+
errFeeRateTooLow := fmt.Sprintf("fee rate %s too low, "+
2722+
"min_relay_fee: ", tooLowFeeRateAmount.FeePerKWeight())
2723+
require.ErrorContains(t.t, err, errFeeRateTooLow)
2724+
}

itest/litd_test_list_on_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@ var allTestCases = []*testCase{
6060
name: "test custom channels oracle pricing",
6161
test: testCustomChannelsOraclePricing,
6262
},
63+
{
64+
name: "test custom channels fee",
65+
test: testCustomChannelsFee,
66+
},
6367
}

0 commit comments

Comments
 (0)