@@ -184,14 +184,14 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
184184 // Make sure the pending channel shows up in the list and has the
185185 // custom records set as JSON.
186186 assertPendingChannels (
187- t .t , charlieTap .node , assetID , 1 , charlieFundingAmount , 0 ,
187+ t .t , charlieTap .node , mintedAsset , 1 , charlieFundingAmount , 0 ,
188188 )
189189 assertPendingChannels (
190- t .t , daveTap .node , assetID , 2 , daveFundingAmount ,
190+ t .t , daveTap .node , mintedAsset , 2 , daveFundingAmount ,
191191 charlieFundingAmount ,
192192 )
193193 assertPendingChannels (
194- t .t , erinTap .node , assetID , 1 , erinFundingAmount , 0 ,
194+ t .t , erinTap .node , mintedAsset , 1 , erinFundingAmount , 0 ,
195195 )
196196
197197 // Now that we've looked at the pending channels, let's actually confirm
@@ -259,13 +259,14 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
259259 // Make sure the channel shows the correct asset information.
260260 assertAssetChan (
261261 t .t , charlieTap .node , daveTap .node , charlieFundingAmount ,
262- assetID ,
262+ mintedAsset ,
263263 )
264264 assertAssetChan (
265- t .t , daveTap .node , yaraTap .node , daveFundingAmount , assetID ,
265+ t .t , daveTap .node , yaraTap .node , daveFundingAmount , mintedAsset ,
266266 )
267267 assertAssetChan (
268- t .t , erinTap .node , fabiaTap .node , erinFundingAmount , assetID ,
268+ t .t , erinTap .node , fabiaTap .node , erinFundingAmount ,
269+ mintedAsset ,
269270 )
270271
271272 chanPointCD := & lnrpc.ChannelPoint {
@@ -451,8 +452,9 @@ func assertUniverseProofExists(t *testing.T, universe *tapClient,
451452 return a
452453}
453454
454- func assertPendingChannels (t * testing.T , node * HarnessNode , assetID []byte ,
455- numChannels int , localSum , remoteSum uint64 ) {
455+ func assertPendingChannels (t * testing.T , node * HarnessNode ,
456+ mintedAsset * taprpc.Asset , numChannels int , localSum ,
457+ remoteSum uint64 ) {
456458
457459 ctxb := context .Background ()
458460 ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
@@ -474,6 +476,22 @@ func assertPendingChannels(t *testing.T, node *HarnessNode, assetID []byte,
474476
475477 require .NotZero (t , pendingJSON .Assets [0 ].Capacity )
476478
479+ // Check the decimal display of the channel funding blob. If no explicit
480+ // value was set, we assume and expect the value of 0.
481+ var expectedDecimalDisplay uint8
482+ if mintedAsset .DecimalDisplay != nil {
483+ expectedDecimalDisplay = uint8 (
484+ mintedAsset .DecimalDisplay .DecimalDisplay ,
485+ )
486+ }
487+
488+ require .Equal (
489+ t , expectedDecimalDisplay ,
490+ pendingJSON .Assets [0 ].AssetInfo .DecimalDisplay ,
491+ )
492+
493+ // Check the balance of the pending channel.
494+ assetID := mintedAsset .AssetGenesis .AssetId
477495 pendingLocalBalance , pendingRemoteBalance , _ , _ :=
478496 getAssetChannelBalance (
479497 t , node , assetID , true ,
@@ -483,8 +501,9 @@ func assertPendingChannels(t *testing.T, node *HarnessNode, assetID []byte,
483501}
484502
485503func assertAssetChan (t * testing.T , src , dst * HarnessNode , fundingAmount uint64 ,
486- assetID [] byte ) {
504+ mintedAsset * taprpc. Asset ) {
487505
506+ assetID := mintedAsset .AssetGenesis .AssetId
488507 assetIDStr := hex .EncodeToString (assetID )
489508 err := wait .NoError (func () error {
490509 a , err := getChannelCustomData (src , dst )
@@ -501,6 +520,21 @@ func assertAssetChan(t *testing.T, src, dst *HarnessNode, fundingAmount uint64,
501520 fundingAmount , a .Capacity )
502521 }
503522
523+ // Check the decimal display of the channel funding blob. If no
524+ // explicit value was set, we assume and expect the value of 0.
525+ var expectedDecimalDisplay uint8
526+ if mintedAsset .DecimalDisplay != nil {
527+ expectedDecimalDisplay = uint8 (
528+ mintedAsset .DecimalDisplay .DecimalDisplay ,
529+ )
530+ }
531+
532+ if a .AssetInfo .DecimalDisplay != expectedDecimalDisplay {
533+ return fmt .Errorf ("expected decimal display %d, got %d" ,
534+ expectedDecimalDisplay ,
535+ a .AssetInfo .DecimalDisplay )
536+ }
537+
504538 return nil
505539 }, defaultTimeout )
506540 require .NoError (t , err )
0 commit comments