Skip to content

Commit

Permalink
taprpc+rpcserver: add alt leaves to DecodedProof
Browse files Browse the repository at this point in the history
  • Loading branch information
jharveyb committed Dec 6, 2024
1 parent 0e56471 commit 384629c
Show file tree
Hide file tree
Showing 4 changed files with 427 additions and 387 deletions.
15 changes: 15 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,7 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
txMerkleProof = p.TxMerkleProof
inclusionProof = p.InclusionProof
splitRootProof = p.SplitRootProof
altLeaves = p.AltLeaves
)

var txMerkleProofBuf bytes.Buffer
Expand Down Expand Up @@ -1758,6 +1759,19 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
}
}

var altLeavesBuf bytes.Buffer
if altLeaves != nil {
var scratch [8]byte

err := asset.AltLeavesEncoder(
&altLeavesBuf, &altLeaves, &scratch,
)
if err != nil {
return nil, fmt.Errorf("unable to encode alt leaves: "+
"%w", err)
}
}

rpcAsset, err := r.MarshalChainAsset(ctx, &asset.ChainAsset{
Asset: &p.Asset,
AnchorTx: &p.AnchorTx,
Expand Down Expand Up @@ -1837,6 +1851,7 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
IsBurn: p.Asset.IsBurn(),
GenesisReveal: genesisReveal,
GroupKeyReveal: &GroupKeyReveal,
AltLeaves: altLeavesBuf.Bytes(),
}, nil
}

Expand Down
Loading

0 comments on commit 384629c

Please sign in to comment.