|
46 | 46 | AssetType: taprpc.AssetType_NORMAL,
|
47 | 47 | Name: "itest-asset-cents",
|
48 | 48 | AssetMeta: dummyMetaData,
|
| 49 | + |
| 50 | + // Note: Amount must be large enough to satisfy `daveFundingAmount`, |
| 51 | + // `erinFundingAmount`, and `charlieFundingAmount` defined below in each |
| 52 | + // test case. |
49 | 53 | Amount: 1_000_000,
|
50 | 54 | }
|
51 | 55 |
|
@@ -196,15 +200,23 @@ func testCustomChannelsLarge(_ context.Context, net *NetworkHarness,
|
196 | 200 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
197 | 201 | t.Logf("Universes synced between all nodes, distributing assets...")
|
198 | 202 |
|
| 203 | + // Define the sizes of each channel that is opened. |
| 204 | + // Note: Dave needs to have the larger channel size. |
199 | 205 | const (
|
200 | 206 | daveFundingAmount = uint64(400_000)
|
201 | 207 | erinFundingAmount = uint64(200_000)
|
202 | 208 | )
|
203 |
| - charlieFundingAmount := cents.Amount - uint64(2*400_000) |
| 209 | + |
| 210 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 211 | + // Erin won't use it all. |
| 212 | + const assetSendAmount = daveFundingAmount |
| 213 | + |
| 214 | + // Charlie uses the rest of the funds that are minted in his channel |
| 215 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
204 | 216 |
|
205 | 217 | chanPointCD, _, _ := createTestAssetNetwork(
|
206 | 218 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
207 |
| - universeTap, cents, 400_000, charlieFundingAmount, |
| 219 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
208 | 220 | daveFundingAmount, erinFundingAmount, DefaultPushSat,
|
209 | 221 | )
|
210 | 222 |
|
@@ -385,15 +397,23 @@ func testCustomChannels(ctx context.Context, net *NetworkHarness,
|
385 | 397 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
386 | 398 | t.Logf("Universes synced between all nodes, distributing assets...")
|
387 | 399 |
|
| 400 | + // Define the sizes of each channel that is opened. |
| 401 | + // Note: Dave needs to have the larger channel size. |
388 | 402 | const (
|
389 | 403 | daveFundingAmount = uint64(startAmount)
|
390 | 404 | erinFundingAmount = uint64(fundingAmount)
|
391 | 405 | )
|
392 |
| - charlieFundingAmount := cents.Amount - 2*startAmount |
| 406 | + |
| 407 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 408 | + // Erin won't use it all. |
| 409 | + const assetSendAmount = daveFundingAmount |
| 410 | + |
| 411 | + // Charlie uses the rest of the funds that are minted in his channel |
| 412 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
393 | 413 |
|
394 | 414 | chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
|
395 | 415 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
396 |
| - universeTap, cents, startAmount, charlieFundingAmount, |
| 416 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
397 | 417 | daveFundingAmount, erinFundingAmount, DefaultPushSat,
|
398 | 418 | )
|
399 | 419 |
|
@@ -852,15 +872,23 @@ func testCustomChannelsGroupedAsset(ctx context.Context, net *NetworkHarness,
|
852 | 872 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
853 | 873 | t.Logf("Universes synced between all nodes, distributing assets...")
|
854 | 874 |
|
| 875 | + // Define the sizes of each channel that is opened. |
| 876 | + // Note: Dave needs to have the larger channel size. |
855 | 877 | const (
|
856 | 878 | daveFundingAmount = uint64(startAmount)
|
857 | 879 | erinFundingAmount = uint64(fundingAmount)
|
858 | 880 | )
|
859 |
| - charlieFundingAmount := cents.Amount - 2*startAmount |
| 881 | + |
| 882 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 883 | + // Erin won't use it all. |
| 884 | + const assetSendAmount = daveFundingAmount |
| 885 | + |
| 886 | + // Charlie uses the rest of the funds that are minted in his channel |
| 887 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
860 | 888 |
|
861 | 889 | chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
|
862 | 890 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
863 |
| - universeTap, cents, startAmount, charlieFundingAmount, |
| 891 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
864 | 892 | daveFundingAmount, erinFundingAmount, DefaultPushSat,
|
865 | 893 | )
|
866 | 894 |
|
@@ -1818,15 +1846,23 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context,
|
1818 | 1846 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
1819 | 1847 | t.Logf("Universes synced between all nodes, distributing assets...")
|
1820 | 1848 |
|
| 1849 | + // Define the sizes of each channel that is opened. |
| 1850 | + // Note: Dave needs to have the larger channel size. |
1821 | 1851 | const (
|
1822 | 1852 | daveFundingAmount = uint64(400_000)
|
1823 | 1853 | erinFundingAmount = uint64(200_000)
|
1824 | 1854 | )
|
1825 |
| - charlieFundingAmount := cents.Amount - uint64(2*400_000) |
| 1855 | + |
| 1856 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 1857 | + // Erin won't use it all. |
| 1858 | + const assetSendAmount = daveFundingAmount |
| 1859 | + |
| 1860 | + // Charlie uses the rest of the funds that are minted in his channel |
| 1861 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
1826 | 1862 |
|
1827 | 1863 | _, _, _ = createTestAssetNetwork(
|
1828 | 1864 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
1829 |
| - universeTap, cents, 400_000, charlieFundingAmount, |
| 1865 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
1830 | 1866 | daveFundingAmount, erinFundingAmount, 0,
|
1831 | 1867 | )
|
1832 | 1868 |
|
@@ -2265,15 +2301,23 @@ func testCustomChannelsStrictForwarding(ctx context.Context,
|
2265 | 2301 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
2266 | 2302 | t.Logf("Universes synced between all nodes, distributing assets...")
|
2267 | 2303 |
|
| 2304 | + // Define the sizes of each channel that is opened. |
| 2305 | + // Note: Dave needs to have the larger channel size. |
2268 | 2306 | const (
|
2269 | 2307 | daveFundingAmount = uint64(400_000)
|
2270 | 2308 | erinFundingAmount = uint64(200_000)
|
2271 | 2309 | )
|
2272 |
| - charlieFundingAmount := cents.Amount - uint64(2*400_000) |
| 2310 | + |
| 2311 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 2312 | + // Erin won't use it all. |
| 2313 | + const assetSendAmount = daveFundingAmount |
| 2314 | + |
| 2315 | + // Charlie uses the rest of the funds that are minted in his channel |
| 2316 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
2273 | 2317 |
|
2274 | 2318 | _, _, _ = createTestAssetNetwork(
|
2275 | 2319 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
2276 |
| - universeTap, cents, 400_000, charlieFundingAmount, |
| 2320 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
2277 | 2321 | daveFundingAmount, erinFundingAmount, 0,
|
2278 | 2322 | )
|
2279 | 2323 |
|
@@ -2850,16 +2894,26 @@ func testCustomChannelsOraclePricing(ctx context.Context, net *NetworkHarness,
|
2850 | 2894 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
2851 | 2895 | t.Logf("Universes synced between all nodes, distributing assets...")
|
2852 | 2896 |
|
| 2897 | + |
| 2898 | + |
| 2899 | + |
| 2900 | + // Define the sizes of each channel that is opened. |
| 2901 | + // Note: Dave needs to have the larger channel size. |
2853 | 2902 | const (
|
2854 |
| - sendAmount = uint64(400_000_000) |
2855 | 2903 | daveFundingAmount = uint64(400_000_000)
|
2856 | 2904 | erinFundingAmount = uint64(200_000_000)
|
2857 | 2905 | )
|
2858 |
| - charlieFundingAmount := usdAsset.Amount - 2*sendAmount |
| 2906 | + |
| 2907 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 2908 | + // Erin won't use it all. |
| 2909 | + const assetSendAmount = daveFundingAmount |
| 2910 | + |
| 2911 | + // Charlie uses the rest of the funds that are minted in his channel |
| 2912 | + charlieFundingAmount := usdAsset.Amount - 2*assetSendAmount |
2859 | 2913 |
|
2860 | 2914 | chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
|
2861 | 2915 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
2862 |
| - universeTap, usdAsset, sendAmount, charlieFundingAmount, |
| 2916 | + universeTap, usdAsset, assetSendAmount, charlieFundingAmount, |
2863 | 2917 | daveFundingAmount, erinFundingAmount, 0,
|
2864 | 2918 | )
|
2865 | 2919 |
|
@@ -3739,15 +3793,23 @@ func testCustomChannelsForwardBandwidth(ctx context.Context,
|
3739 | 3793 | syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
|
3740 | 3794 | t.Logf("Universes synced between all nodes, distributing assets...")
|
3741 | 3795 |
|
| 3796 | + // Define the sizes of each channel that is opened. |
| 3797 | + // Note: Dave needs to have the larger channel size. |
3742 | 3798 | const (
|
3743 | 3799 | daveFundingAmount = uint64(400_000)
|
3744 | 3800 | erinFundingAmount = uint64(200_000)
|
3745 | 3801 | )
|
3746 |
| - charlieFundingAmount := cents.Amount - uint64(2*400_000) |
| 3802 | + |
| 3803 | + // Give Dave and Erin both the same amount of on chain funds even though |
| 3804 | + // Erin won't use it all. |
| 3805 | + const assetSendAmount = daveFundingAmount |
| 3806 | + |
| 3807 | + // Charlie uses the rest of the funds that are minted in his channel |
| 3808 | + charlieFundingAmount := cents.Amount - 2*assetSendAmount |
3747 | 3809 |
|
3748 | 3810 | _, _, chanPointEF := createTestAssetNetwork(
|
3749 | 3811 | t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
|
3750 |
| - universeTap, cents, 400_000, charlieFundingAmount, |
| 3812 | + universeTap, cents, assetSendAmount, charlieFundingAmount, |
3751 | 3813 | daveFundingAmount, erinFundingAmount, 0,
|
3752 | 3814 | )
|
3753 | 3815 |
|
|
0 commit comments