@@ -1061,7 +1061,7 @@ func (r *rpcServer) MarshalChainAsset(ctx context.Context, a *asset.ChainAsset,
10611061 // the database when decoding a decimal display value.
10621062 switch {
10631063 case meta != nil :
1064- decDisplay , err = getDecimalDisplayNonStrict ( meta )
1064+ decDisplay , err = meta . DecDisplayOption ( )
10651065 default :
10661066 decDisplay , err = r .DecDisplayForAssetID (ctx , a .ID ())
10671067 }
@@ -7603,43 +7603,13 @@ func encodeVirtualPackets(packets []*tappsbt.VPacket) ([][]byte, error) {
76037603func (r * rpcServer ) DecDisplayForAssetID (ctx context.Context ,
76047604 id asset.ID ) (fn.Option [uint32 ], error ) {
76057605
7606- meta , err := r .cfg .AssetStore .FetchAssetMetaForAsset (
7607- ctx , id ,
7608- )
7606+ meta , err := r .cfg .AssetStore .FetchAssetMetaForAsset (ctx , id )
76097607 if err != nil {
76107608 return fn .None [uint32 ](), fmt .Errorf ("unable to fetch asset " +
76117609 "meta for asset_id=%v :%v" , id , err )
76127610 }
76137611
7614- return getDecimalDisplayNonStrict (meta )
7615- }
7616-
7617- // getDecimalDisplayNonStrict attempts to decode a decimal display value from
7618- // metadata. If no custom decimal display value is decoded, the default value of
7619- // 0 is returned without error.
7620- func getDecimalDisplayNonStrict (
7621- meta * proof.MetaReveal ) (fn.Option [uint32 ], error ) {
7622-
7623- _ , decDisplay , err := meta .GetDecDisplay ()
7624- switch {
7625- // If it isn't JSON, or doesn't have a dec display, we'll just return 0
7626- // below.
7627- case errors .Is (err , proof .ErrNotJSON ):
7628- fallthrough
7629- case errors .Is (err , proof .ErrInvalidJSON ):
7630- fallthrough
7631- case errors .Is (err , proof .ErrDecDisplayMissing ):
7632- fallthrough
7633- case errors .Is (err , proof .ErrDecDisplayInvalidType ):
7634- // We can't determine if there is a decimal display value set.
7635- return fn .None [uint32 ](), nil
7636-
7637- case err != nil :
7638- return fn .None [uint32 ](), fmt .Errorf ("unable to extract " +
7639- "decimal display: %v" , err )
7640- }
7641-
7642- return fn .Some (decDisplay ), nil
7612+ return meta .DecDisplayOption ()
76437613}
76447614
76457615// rfqChannel returns the channel to use for RFQ operations. If a peer public
0 commit comments