Skip to content

rpcserver+taprpc: add issuance reveal data to proof leaf #1486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 53 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5476,14 +5476,65 @@ func (r *rpcServer) marshalUniverseProofLeaf(ctx context.Context,
return nil, err
}

return &unirpc.AssetProofResponse{
response := &unirpc.AssetProofResponse{
Req: req,
UniverseRoot: uniRoot,
UniverseInclusionProof: uniProof,
AssetLeaf: assetLeaf,
MultiverseRoot: multiverseRoot,
MultiverseInclusionProof: multiverseProof,
}, nil
}

if req.Id.ProofType != unirpc.ProofType_PROOF_TYPE_TRANSFER {
p, err := proof.Leaf.RawProof.AsSingleProof()
if err != nil {
return nil, err
}

// If this isn't a genesis reveal, it means we have a transfer
// proof after all (perhaps because the proof type was given
// as ProofType_PROOF_TYPE_UNSPECIFIED).
if p.GenesisReveal == nil {
return response, nil
}

genReveal := p.GenesisReveal
issuanceData := &unirpc.IssuanceData{
GenesisReveal: &taprpc.GenesisReveal{
// nolint:lll
GenesisBaseReveal: &taprpc.GenesisInfo{
GenesisPoint: genReveal.FirstPrevOut.String(),
Name: genReveal.Tag,
MetaHash: genReveal.MetaHash[:],
AssetId: fn.ByteSlice(p.Asset.ID()),
OutputIndex: genReveal.OutputIndex,
AssetType: taprpc.AssetType(p.Asset.Type),
},
},
}

if p.GroupKeyReveal != nil {
rawKey := p.GroupKeyReveal.RawKey()
issuanceData.GroupKeyReveal = &taprpc.GroupKeyReveal{
RawGroupKey: rawKey[:],
TapscriptRoot: p.GroupKeyReveal.TapscriptRoot(),
}
}

if p.MetaReveal != nil {
issuanceData.MetaReveal = &taprpc.AssetMeta{
Data: p.MetaReveal.Data,
Type: taprpc.AssetMetaType(
p.MetaReveal.Type,
),
MetaHash: fn.ByteSlice(p.MetaReveal.MetaHash()),
}
}

response.IssuanceData = issuanceData
}

return response, nil
}

// QueryProof attempts to query for an issuance or transfer proof for a given
Expand Down
Loading
Loading