@@ -447,6 +447,7 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
447
447
)
448
448
449
449
// Charlie should still have four asset pieces, two with the same size.
450
+ assertNumAssetOutputs (t .t , charlieTap , assetID , 2 )
450
451
assertAssetExists (
451
452
t .t , charlieTap , assetID , charlieAssetBalance - fundingAmount ,
452
453
nil , true , false , false ,
@@ -456,14 +457,44 @@ func testCustomChannels(_ context.Context, net *NetworkHarness,
456
457
false ,
457
458
)
458
459
459
- // For some reason, the channel funding output of the immediately closed
460
- // channel is still present in the asset DB, even after we import the
461
- // co-op close transaction proof.
462
- // TODO(guggero): Investigate this. The actual number of outputs should
463
- // be two here, and we shouldn't have the extra fundingAmount in the
464
- // balance.
465
- charlieAssetBalance += fundingAmount
466
- assertNumAssetOutputs (t .t , charlieTap , assetID , 3 )
460
+ // Dave should have two outputs, one from the initial channel with Yara
461
+ // and one from the remaining amount of the channel with Charlie.
462
+ assertNumAssetOutputs (t .t , daveTap , assetID , 2 )
463
+ daveFirstChannelRemainder := daveFundingAmount - yaraInvoiceAssetAmount1
464
+ assertAssetExists (
465
+ t .t , daveTap , assetID , daveFirstChannelRemainder , nil , true ,
466
+ true , false ,
467
+ )
468
+ assertAssetExists (
469
+ t .t , daveTap , assetID ,
470
+ daveAssetBalance - daveFirstChannelRemainder , nil , true , true ,
471
+ false ,
472
+ )
473
+
474
+ // Fabia and Yara should all have a single output each, just what was
475
+ // left over from the initial channel.
476
+ assertNumAssetOutputs (t .t , fabiaTap , assetID , 1 )
477
+ assertAssetExists (
478
+ t .t , fabiaTap , assetID , fabiaAssetBalance , nil , true , true ,
479
+ false ,
480
+ )
481
+ assertNumAssetOutputs (t .t , yaraTap , assetID , 1 )
482
+ assertAssetExists (
483
+ t .t , yaraTap , assetID , yaraAssetBalance , nil , true , true , false ,
484
+ )
485
+
486
+ // Erin didn't use all of his assets when opening the channel, so he
487
+ // should have two outputs, the change from the channel opening and the
488
+ // remaining amount after closing the channel.
489
+ assertNumAssetOutputs (t .t , erinTap , assetID , 2 )
490
+ erinChange := startAmount - erinFundingAmount
491
+ assertAssetExists (
492
+ t .t , erinTap , assetID , erinAssetBalance - erinChange , nil , true ,
493
+ true , false ,
494
+ )
495
+ assertAssetExists (
496
+ t .t , erinTap , assetID , erinChange , nil , true , false , false ,
497
+ )
467
498
468
499
// The asset balances should still remain unchanged.
469
500
assertAssetBalance (t .t , charlieTap , assetID , charlieAssetBalance )
0 commit comments