@@ -188,7 +188,7 @@ func testCustomChannelsLarge(_ context.Context, net *NetworkHarness,
188188 fundRespCD , _ , _ := createTestAssetNetwork (
189189 t , net , charlieTap , daveTap , erinTap , fabiaTap , yaraTap ,
190190 universeTap , cents , 400_000 , charlieFundingAmount ,
191- daveFundingAmount , erinFundingAmount ,
191+ daveFundingAmount , erinFundingAmount , DefaultPushSat ,
192192 )
193193
194194 // Before we start sending out payments, let's make sure each node can
@@ -370,7 +370,7 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
370370 fundRespCD , fundRespDY , fundRespEF := createTestAssetNetwork (
371371 t , net , charlieTap , daveTap , erinTap , fabiaTap , yaraTap ,
372372 universeTap , cents , startAmount , charlieFundingAmount ,
373- daveFundingAmount , erinFundingAmount ,
373+ daveFundingAmount , erinFundingAmount , DefaultPushSat ,
374374 )
375375
376376 // We'll be tracking the expected asset balances throughout the test, so
@@ -829,7 +829,7 @@ func testCustomChannelsGroupedAsset(_ context.Context, net *NetworkHarness,
829829 fundRespCD , fundRespDY , fundRespEF := createTestAssetNetwork (
830830 t , net , charlieTap , daveTap , erinTap , fabiaTap , yaraTap ,
831831 universeTap , cents , startAmount , charlieFundingAmount ,
832- daveFundingAmount , erinFundingAmount ,
832+ daveFundingAmount , erinFundingAmount , DefaultPushSat ,
833833 )
834834
835835 // We'll be tracking the expected asset balances throughout the test, so
@@ -1690,10 +1690,13 @@ func testCustomChannelsBreach(_ context.Context, net *NetworkHarness,
16901690func testCustomChannelsLiquidityEdgeCases (_ context.Context ,
16911691 net * NetworkHarness , t * harnessTest ) {
16921692
1693- ctxb := context .Background ()
16941693 lndArgs := slices .Clone (lndArgsTemplate )
16951694 litdArgs := slices .Clone (litdArgsTemplate )
16961695
1696+ // Explicitly set the proof courier as Alice (how has no other role
1697+ // other than proof shuffling), otherwise a hashmail courier will be
1698+ // used. For the funding transaction, we're just posting it and don't
1699+ // expect a true receiver.
16971700 zane , err := net .NewNode (
16981701 t .t , "Zane" , lndArgs , false , true , litdArgs ... ,
16991702 )
@@ -1704,36 +1707,67 @@ func testCustomChannelsLiquidityEdgeCases(_ context.Context,
17041707 proof .UniverseRpcCourierType , zane .Cfg .LitAddr (),
17051708 ))
17061709
1710+ // The topology we are going for looks like the following:
1711+ //
1712+ // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia
1713+ // |
1714+ // |
1715+ // [assets]
1716+ // |
1717+ // v
1718+ // Yara
1719+ //
1720+ // With [assets] being a custom channel and [sats] being a normal, BTC
1721+ // only channel.
1722+ // All 5 nodes need to be full litd nodes running in integrated mode
1723+ // with tapd included. We also need specific flags to be enabled, so we
1724+ // create 5 completely new nodes, ignoring the two default nodes that
1725+ // are created by the harness.
17071726 charlie , err := net .NewNode (
17081727 t .t , "Charlie" , lndArgs , false , true , litdArgs ... ,
17091728 )
17101729 require .NoError (t .t , err )
1730+
17111731 dave , err := net .NewNode (t .t , "Dave" , lndArgs , false , true , litdArgs ... )
17121732 require .NoError (t .t , err )
17131733 erin , err := net .NewNode (t .t , "Erin" , lndArgs , false , true , litdArgs ... )
17141734 require .NoError (t .t , err )
1735+ fabia , err := net .NewNode (
1736+ t .t , "Fabia" , lndArgs , false , true , litdArgs ... ,
1737+ )
1738+ require .NoError (t .t , err )
1739+ yara , err := net .NewNode (
1740+ t .t , "Yara" , lndArgs , false , true , litdArgs ... ,
1741+ )
1742+ require .NoError (t .t , err )
17151743
1716- nodes := []* HarnessNode {charlie , dave , erin }
1744+ nodes := []* HarnessNode {charlie , dave , erin , fabia , yara }
17171745 connectAllNodes (t .t , net , nodes )
17181746 fundAllNodes (t .t , net , nodes )
17191747
17201748 // Create the normal channel between Dave and Erin.
17211749 t .Logf ("Opening normal channel between Dave and Erin..." )
17221750 channelOp := openChannelAndAssert (
17231751 t , net , dave , erin , lntest.OpenChannelParams {
1724- Amt : 5_000_000 ,
1752+ Amt : 10_000_000 ,
17251753 SatPerVByte : 5 ,
17261754 },
17271755 )
17281756 defer closeChannelAndAssert (t , net , dave , channelOp , false )
17291757
1758+ // This is the only public channel, we need everyone to be aware of it.
17301759 assertChannelKnown (t .t , charlie , channelOp )
1760+ assertChannelKnown (t .t , fabia , channelOp )
17311761
1762+ universeTap := newTapClient (t .t , zane )
17321763 charlieTap := newTapClient (t .t , charlie )
17331764 daveTap := newTapClient (t .t , dave )
1734- universeTap := newTapClient (t .t , zane )
1765+ erinTap := newTapClient (t .t , erin )
1766+ fabiaTap := newTapClient (t .t , fabia )
1767+ yaraTap := newTapClient (t .t , yara )
17351768
1736- // Mint an asset on Charlie and sync Dave to Charlie as the universe.
1769+ // Mint an asset on Charlie and sync all nodes to Charlie as the
1770+ // universe.
17371771 mintedAssets := itest .MintAssetsConfirmBatch (
17381772 t .t , t .lndHarness .Miner .Client , charlieTap ,
17391773 []* mintrpc.MintAssetRequest {
@@ -1744,62 +1778,32 @@ func testCustomChannelsLiquidityEdgeCases(_ context.Context,
17441778 )
17451779 cents := mintedAssets [0 ]
17461780 assetID := cents .AssetGenesis .AssetId
1747- var groupKey []byte
1748- if cents .AssetGroup != nil {
1749- groupKey = cents .AssetGroup .TweakedGroupKey
1750- }
1751- fundingScriptTree := tapchannel .NewFundingScriptTree ()
1752- fundingScriptKey := fundingScriptTree .TaprootKey
1753- fundingScriptTreeBytes := fundingScriptKey .SerializeCompressed ()
17541781
17551782 t .Logf ("Minted %d lightning cents, syncing universes..." , cents .Amount )
1756- syncUniverses (t .t , charlieTap , dave )
1783+ syncUniverses (t .t , charlieTap , dave , erin , fabia , yara )
17571784 t .Logf ("Universes synced between all nodes, distributing assets..." )
17581785
1759- charlieBalance := cents .Amount
1760-
1761- fundRespCD , err := charlieTap .FundChannel (
1762- ctxb , & tchrpc.FundChannelRequest {
1763- AssetAmount : charlieBalance ,
1764- AssetId : assetID ,
1765- PeerPubkey : daveTap .node .PubKey [:],
1766- FeeRateSatPerVbyte : 5 ,
1767- PushSat : 0 ,
1768- },
1769- )
1770- require .NoError (t .t , err )
1771- t .Logf ("Funded channel between Charlie and Dave: %v" , fundRespCD )
1772-
1773- // Make sure the pending channel shows up in the list and has the
1774- // custom records set as JSON.
1775- assertPendingChannels (
1776- t .t , charlieTap .node , assetID , 1 , charlieBalance , 0 ,
1777- )
1778-
1779- // Let's confirm the channel.
1780- mineBlocks (t , net , 6 , 1 )
1781-
1782- assertAssetBalance (t .t , charlieTap , assetID , cents .Amount )
1783-
1784- // There should only be a single asset piece for Charlie, the one in the
1785- // channel.
1786- assertNumAssetOutputs (t .t , charlieTap , assetID , 1 )
1787- assertAssetExists (
1788- t .t , charlieTap , assetID , charlieBalance ,
1789- fundingScriptKey , false , true , true ,
1786+ const (
1787+ daveFundingAmount = uint64 (400_000 )
1788+ erinFundingAmount = uint64 (200_000 )
17901789 )
1790+ charlieFundingAmount := cents .Amount - uint64 (2 * 400_000 )
17911791
1792- // Assert that the proofs for both channels has been uploaded to the
1793- // designated Universe server.
1794- assertUniverseProofExists (
1795- t .t , universeTap , assetID , groupKey , fundingScriptTreeBytes ,
1796- fmt .Sprintf ("%v:%v" , fundRespCD .Txid , fundRespCD .OutputIndex ),
1792+ _ , _ , _ = createTestAssetNetwork (
1793+ t , net , charlieTap , daveTap , erinTap , fabiaTap , yaraTap ,
1794+ universeTap , cents , 400_000 , charlieFundingAmount ,
1795+ daveFundingAmount , erinFundingAmount , 0 ,
17971796 )
17981797
1799- // Make sure the channel shows the correct asset information.
1800- assertAssetChan (
1801- t .t , charlieTap .node , daveTap .node , charlieBalance , assetID ,
1802- )
1798+ // Before we start sending out payments, let's make sure each node can
1799+ // see the other one in the graph and has all required features.
1800+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (charlie , dave ))
1801+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (dave , charlie ))
1802+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (dave , yara ))
1803+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (yara , dave ))
1804+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (erin , fabia ))
1805+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (fabia , erin ))
1806+ require .NoError (t .t , t .lndHarness .AssertNodeKnown (charlie , erin ))
18031807
18041808 logBalance (t .t , nodes , assetID , "initial" )
18051809
0 commit comments