@@ -184,14 +184,14 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
184
184
// Make sure the pending channel shows up in the list and has the
185
185
// custom records set as JSON.
186
186
assertPendingChannels (
187
- t .t , charlieTap .node , assetID , 1 , charlieFundingAmount , 0 ,
187
+ t .t , charlieTap .node , mintedAsset , 1 , charlieFundingAmount , 0 ,
188
188
)
189
189
assertPendingChannels (
190
- t .t , daveTap .node , assetID , 2 , daveFundingAmount ,
190
+ t .t , daveTap .node , mintedAsset , 2 , daveFundingAmount ,
191
191
charlieFundingAmount ,
192
192
)
193
193
assertPendingChannels (
194
- t .t , erinTap .node , assetID , 1 , erinFundingAmount , 0 ,
194
+ t .t , erinTap .node , mintedAsset , 1 , erinFundingAmount , 0 ,
195
195
)
196
196
197
197
// Now that we've looked at the pending channels, let's actually confirm
@@ -259,13 +259,14 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
259
259
// Make sure the channel shows the correct asset information.
260
260
assertAssetChan (
261
261
t .t , charlieTap .node , daveTap .node , charlieFundingAmount ,
262
- assetID ,
262
+ mintedAsset ,
263
263
)
264
264
assertAssetChan (
265
- t .t , daveTap .node , yaraTap .node , daveFundingAmount , assetID ,
265
+ t .t , daveTap .node , yaraTap .node , daveFundingAmount , mintedAsset ,
266
266
)
267
267
assertAssetChan (
268
- t .t , erinTap .node , fabiaTap .node , erinFundingAmount , assetID ,
268
+ t .t , erinTap .node , fabiaTap .node , erinFundingAmount ,
269
+ mintedAsset ,
269
270
)
270
271
271
272
chanPointCD := & lnrpc.ChannelPoint {
@@ -451,8 +452,9 @@ func assertUniverseProofExists(t *testing.T, universe *tapClient,
451
452
return a
452
453
}
453
454
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 ) {
456
458
457
459
ctxb := context .Background ()
458
460
ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
@@ -474,6 +476,22 @@ func assertPendingChannels(t *testing.T, node *HarnessNode, assetID []byte,
474
476
475
477
require .NotZero (t , pendingJSON .Assets [0 ].Capacity )
476
478
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
477
495
pendingLocalBalance , pendingRemoteBalance , _ , _ :=
478
496
getAssetChannelBalance (
479
497
t , node , assetID , true ,
@@ -483,8 +501,9 @@ func assertPendingChannels(t *testing.T, node *HarnessNode, assetID []byte,
483
501
}
484
502
485
503
func assertAssetChan (t * testing.T , src , dst * HarnessNode , fundingAmount uint64 ,
486
- assetID [] byte ) {
504
+ mintedAsset * taprpc. Asset ) {
487
505
506
+ assetID := mintedAsset .AssetGenesis .AssetId
488
507
assetIDStr := hex .EncodeToString (assetID )
489
508
err := wait .NoError (func () error {
490
509
a , err := getChannelCustomData (src , dst )
@@ -501,6 +520,21 @@ func assertAssetChan(t *testing.T, src, dst *HarnessNode, fundingAmount uint64,
501
520
fundingAmount , a .Capacity )
502
521
}
503
522
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
+
504
538
return nil
505
539
}, defaultTimeout )
506
540
require .NoError (t , err )
0 commit comments