@@ -27,6 +27,7 @@ import (
27
27
"github.com/lightningnetwork/lnd/lntest"
28
28
"github.com/lightningnetwork/lnd/lntest/port"
29
29
"github.com/lightningnetwork/lnd/lntest/wait"
30
+ "github.com/lightningnetwork/lnd/lnwallet/chainfee"
30
31
"github.com/lightningnetwork/lnd/lnwire"
31
32
"github.com/stretchr/testify/require"
32
33
)
@@ -2637,3 +2638,71 @@ func testCustomChannelsOraclePricing(_ context.Context,
2637
2638
noOpCoOpCloseBalanceCheck ,
2638
2639
)
2639
2640
}
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 that is too low.
2692
+ tooLowFeeRate := uint32 (1 )
2693
+ tooLowFeeRateAmount := chainfee .SatPerVByte (tooLowFeeRate )
2694
+
2695
+ _ , err = charlieTap .FundChannel (
2696
+ ctxb , & tchrpc.FundChannelRequest {
2697
+ AssetAmount : cents .Amount ,
2698
+ AssetId : assetID ,
2699
+ PeerPubkey : daveTap .node .PubKey [:],
2700
+ FeeRateSatPerVbyte : tooLowFeeRate ,
2701
+ PushSat : 0 ,
2702
+ },
2703
+ )
2704
+
2705
+ errStr := fmt .Sprintf ("fee rate %s too low, min_relay_fee: " ,
2706
+ tooLowFeeRateAmount .FeePerKWeight ())
2707
+ require .ErrorContains (t .t , err , errStr )
2708
+ }
0 commit comments