Skip to content

Commit 3b56d4e

Browse files
authored
Merge pull request #744 from lightninglabs/decode-proof-meta-reveal
rpcserver: skip local meta data lookup for genesis proof
2 parents 0a63d81 + 6e07fa7 commit 3b56d4e

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

rpcserver.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,21 +1408,31 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
14081408
}
14091409

14101410
if withMetaReveal {
1411-
metaHash := rpcAsset.AssetGenesis.MetaHash
1412-
if len(metaHash) == 0 {
1411+
switch {
1412+
case p.MetaReveal != nil:
1413+
rpcMeta = &taprpc.AssetMeta{
1414+
Data: p.MetaReveal.Data,
1415+
Type: taprpc.AssetMetaType(
1416+
p.MetaReveal.Type,
1417+
),
1418+
MetaHash: fn.ByteSlice(p.MetaReveal.MetaHash()),
1419+
}
1420+
1421+
case len(rpcAsset.AssetGenesis.MetaHash) == 0:
14131422
return nil, fmt.Errorf("asset does not contain meta " +
14141423
"data")
1415-
}
14161424

1417-
rpcMeta, err = r.FetchAssetMeta(
1418-
ctx, &taprpc.FetchAssetMetaRequest{
1425+
default:
1426+
metaHash := rpcAsset.AssetGenesis.MetaHash
1427+
req := &taprpc.FetchAssetMetaRequest{
14191428
Asset: &taprpc.FetchAssetMetaRequest_MetaHash{
14201429
MetaHash: metaHash,
14211430
},
1422-
},
1423-
)
1424-
if err != nil {
1425-
return nil, err
1431+
}
1432+
rpcMeta, err = r.FetchAssetMeta(ctx, req)
1433+
if err != nil {
1434+
return nil, err
1435+
}
14261436
}
14271437
}
14281438

0 commit comments

Comments
 (0)