@@ -1229,7 +1229,9 @@ func (r *rpcServer) MarshalChainAsset(ctx context.Context, a asset.ChainAsset,
12291229 case meta != nil :
12301230 decDisplay , err = meta .DecDisplayOption ()
12311231 default :
1232- decDisplay , err = r .DecDisplayForAssetID (ctx , a .ID ())
1232+ decDisplay , err = r .cfg .AddrBook .DecDisplayForAssetID (
1233+ ctx , a .ID (),
1234+ )
12331235 }
12341236 if err != nil {
12351237 return nil , err
@@ -5475,7 +5477,9 @@ func (r *rpcServer) AssetLeaves(ctx context.Context,
54755477 for i , assetLeaf := range assetLeaves {
54765478 assetLeaf := assetLeaf
54775479
5478- decDisplay , err := r .DecDisplayForAssetID (ctx , assetLeaf .ID ())
5480+ decDisplay , err := r .cfg .AddrBook .DecDisplayForAssetID (
5481+ ctx , assetLeaf .ID (),
5482+ )
54795483 if err != nil {
54805484 return nil , err
54815485 }
@@ -5579,7 +5583,9 @@ func (r *rpcServer) marshalUniverseProofLeaf(ctx context.Context,
55795583 return nil , err
55805584 }
55815585
5582- decDisplay , err := r .DecDisplayForAssetID (ctx , proof .Leaf .ID ())
5586+ decDisplay , err := r .cfg .AddrBook .DecDisplayForAssetID (
5587+ ctx , proof .Leaf .ID (),
5588+ )
55835589 if err != nil {
55845590 return nil , err
55855591 }
@@ -6047,7 +6053,7 @@ func (r *rpcServer) marshalUniverseDiff(ctx context.Context,
60476053
60486054 leaves := make ([]* unirpc.AssetLeaf , len (diff .NewLeafProofs ))
60496055 for i , leaf := range diff .NewLeafProofs {
6050- decDisplay , err := r .DecDisplayForAssetID (
6056+ decDisplay , err := r .cfg . AddrBook . DecDisplayForAssetID (
60516057 ctx , leaf .ID (),
60526058 )
60536059 if err != nil {
@@ -6542,7 +6548,7 @@ func (r *rpcServer) marshalAssetSyncSnapshot(ctx context.Context,
65426548 AnchorPoint : a .AnchorPoint .String (),
65436549 }
65446550
6545- decDisplay , err := r .DecDisplayForAssetID (ctx , a .AssetID )
6551+ decDisplay , err := r .cfg . AddrBook . DecDisplayForAssetID (ctx , a .AssetID )
65466552 if err == nil {
65476553 decDisplay .WhenSome (func (u uint32 ) {
65486554 rpcAsset .DecimalDisplay = u
@@ -8559,20 +8565,6 @@ func encodeVirtualPackets(packets []*tappsbt.VPacket) ([][]byte, error) {
85598565 return rawPackets , nil
85608566}
85618567
8562- // DecDisplayForAssetID attempts to fetch the meta reveal for a specific asset
8563- // ID and extract the decimal display value from it.
8564- func (r * rpcServer ) DecDisplayForAssetID (ctx context.Context ,
8565- id asset.ID ) (fn.Option [uint32 ], error ) {
8566-
8567- meta , err := r .cfg .AddrBook .FetchAssetMetaForAsset (ctx , id )
8568- if err != nil {
8569- return fn .None [uint32 ](), fmt .Errorf ("unable to fetch asset " +
8570- "meta for asset_id=%v :%v" , id , err )
8571- }
8572-
8573- return meta .DecDisplayOption ()
8574- }
8575-
85768568// getInboundPolicy returns the policy of the given channel that points towards
85778569// our node, so it's the policy set by the remote peer.
85788570func (r * rpcServer ) getInboundPolicy (ctx context.Context , chanID uint64 ,
@@ -8776,7 +8768,7 @@ func (r *rpcServer) DecodeAssetPayReq(ctx context.Context,
87768768
87778769 // The final piece of information we need is the decimal display
87788770 // information for this asset ID.
8779- decDisplay , err := r .DecDisplayForAssetID (ctx , assetID )
8771+ decDisplay , err := r .cfg . AddrBook . DecDisplayForAssetID (ctx , assetID )
87808772 if err != nil {
87818773 return nil , err
87828774 }
0 commit comments