@@ -1256,9 +1256,18 @@ func testCustomChannelsGroupedAssetTranches(ctx context.Context,
12561256
12571257 // ------------
12581258 // Test case 1: Send a few direct keysend payment from Charlie to Dave.
1259+ // We want to send at least 30k assets, so we use up one channel
1260+ // internal tranche of assets and should at least once have an HTLC
1261+ // that transports assets from two tranches.
12591262 // ------------
1260- const keySendAmount = 100
1261- for i := 0 ; i < 5 ; i ++ {
1263+ const (
1264+ keySendAmount = 5000
1265+ numSends = 6
1266+ totalFirstSend = keySendAmount * numSends
1267+ )
1268+ for i := 0 ; i < numSends ; i ++ {
1269+ // TODO(guggero): Actually specify group key here instead of
1270+ // assetID1 once that is supported by the API.
12621271 sendAssetKeySendPayment (
12631272 t .t , charlie , dave , keySendAmount , assetID1 ,
12641273 fn .None [int64 ](),
@@ -1269,7 +1278,9 @@ func testCustomChannelsGroupedAssetTranches(ctx context.Context,
12691278 // ------------
12701279 // Test case 2: Send a few direct keysend payment from Erin to Fabia.
12711280 // ------------
1272- for i := 0 ; i < 5 ; i ++ {
1281+ for i := 0 ; i < numSends ; i ++ {
1282+ // TODO(guggero): Actually specify group key here instead of
1283+ // assetID1 once that is supported by the API.
12731284 sendAssetKeySendPayment (
12741285 t .t , erin , fabia , keySendAmount , assetID1 ,
12751286 fn .None [int64 ](),
@@ -1290,7 +1301,10 @@ func testCustomChannelsGroupedAssetTranches(ctx context.Context,
12901301 noOpCoOpCloseBalanceCheck ,
12911302 )
12921303
1293- // TODO: assertSpendableBalance(t.t, charlieTap, assetID1, 0)
1304+ assertSpendableBalanceGroup (
1305+ t .t , charlieTap , groupKey , fundingAmount - totalFirstSend + 2 ,
1306+ )
1307+ assertSpendableBalanceGroup (t .t , daveTap , groupKey , totalFirstSend )
12941308
12951309 // ------------
12961310 // Test case 4: Force close the channel between Erin and Fabia.
@@ -1340,7 +1354,37 @@ func testCustomChannelsGroupedAssetTranches(ctx context.Context,
13401354
13411355 mineBlocks (t , net , 1 , 1 )
13421356
1343- // TODO: assertSpendableBalance(t.t, charlieTap, assetID1, 0)
1357+ // Fabia should have her sweep output confirmed now and the assets
1358+ // should be back in her on-chain wallet and spendable.
1359+ assertSpendableBalanceGroup (t .t , fabiaTap , groupKey , totalFirstSend )
1360+
1361+ // Next, we'll mine three additional blocks to trigger the CSV delay
1362+ // for Erin.
1363+ mineBlocks (t , net , 3 , 0 )
1364+
1365+ // We expect that Erin's sweep transaction has been broadcast.
1366+ erinSweepTxid , err := waitForNTxsInMempool (
1367+ net .Miner .Client , 1 , shortTimeout ,
1368+ )
1369+ require .NoError (t .t , err )
1370+
1371+ t .Logf ("Erin sweep txid: %v" , erinSweepTxid )
1372+
1373+ // Now we'll mine a block to confirm Erin's sweep transaction.
1374+ mineBlocks (t , net , 1 , 0 )
1375+
1376+ // Charlie should now have an asset transfer for his sweep transaction.
1377+ erinSweepTransfer := locateAssetTransfers (
1378+ t .t , erinTap , * erinSweepTxid [0 ],
1379+ )
1380+
1381+ t .Logf ("Erin sweep transfer: %v" , toProtoJSON (
1382+ t .t , erinSweepTransfer ,
1383+ ))
1384+
1385+ assertSpendableBalanceGroup (
1386+ t .t , erinTap , groupKey , fundingAmount - totalFirstSend ,
1387+ )
13441388}
13451389
13461390// testCustomChannelsForceClose tests a force close scenario after both parties
0 commit comments