Skip to content

itest: cleaner distribution of on-chain assets #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 77 additions & 15 deletions itest/litd_custom_channels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
AssetType: taprpc.AssetType_NORMAL,
Name: "itest-asset-cents",
AssetMeta: dummyMetaData,

// Note: Amount must be large enough to satisfy `daveFundingAmount`,
// `erinFundingAmount`, and `charlieFundingAmount` defined below in each
// test case.
Amount: 1_000_000,

Check failure on line 53 in itest/litd_custom_channels_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)
}

shortTimeout = time.Second * 5
Expand Down Expand Up @@ -196,15 +200,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(400_000)
erinFundingAmount = uint64(200_000)
)
charlieFundingAmount := cents.Amount - uint64(2*400_000)

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

chanPointCD, _, _ := createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, 400_000, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, DefaultPushSat,
)

Expand Down Expand Up @@ -385,15 +397,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(startAmount)
erinFundingAmount = uint64(fundingAmount)
)
charlieFundingAmount := cents.Amount - 2*startAmount

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, startAmount, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, DefaultPushSat,
)

Expand Down Expand Up @@ -852,15 +872,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(startAmount)
erinFundingAmount = uint64(fundingAmount)
)
charlieFundingAmount := cents.Amount - 2*startAmount

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, startAmount, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, DefaultPushSat,
)

Expand Down Expand Up @@ -1818,15 +1846,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(400_000)
erinFundingAmount = uint64(200_000)
)
charlieFundingAmount := cents.Amount - uint64(2*400_000)

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

_, _, _ = createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, 400_000, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, 0,
)

Expand Down Expand Up @@ -2265,15 +2301,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(400_000)
erinFundingAmount = uint64(200_000)
)
charlieFundingAmount := cents.Amount - uint64(2*400_000)

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

_, _, _ = createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, 400_000, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, 0,
)

Expand Down Expand Up @@ -2850,16 +2894,26 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")




// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
sendAmount = uint64(400_000_000)
daveFundingAmount = uint64(400_000_000)
erinFundingAmount = uint64(200_000_000)
)
charlieFundingAmount := usdAsset.Amount - 2*sendAmount

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := usdAsset.Amount - 2*assetSendAmount

chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, usdAsset, sendAmount, charlieFundingAmount,
universeTap, usdAsset, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, 0,
)

Expand Down Expand Up @@ -3739,15 +3793,23 @@
syncUniverses(t.t, charlieTap, dave, erin, fabia, yara)
t.Logf("Universes synced between all nodes, distributing assets...")

// Define the sizes of each channel that is opened.
// Note: Dave needs to have the larger channel size.
const (
daveFundingAmount = uint64(400_000)
erinFundingAmount = uint64(200_000)
)
charlieFundingAmount := cents.Amount - uint64(2*400_000)

// Give Dave and Erin both the same amount of on chain funds even though
// Erin won't use it all.
const assetSendAmount = daveFundingAmount

// Charlie uses the rest of the funds that are minted in his channel
charlieFundingAmount := cents.Amount - 2*assetSendAmount

_, _, chanPointEF := createTestAssetNetwork(
t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap,
universeTap, cents, 400_000, charlieFundingAmount,
universeTap, cents, assetSendAmount, charlieFundingAmount,
daveFundingAmount, erinFundingAmount, 0,
)

Expand Down
Loading