Skip to content

Commit 36e0d12

Browse files
jharveybguggero
authored andcommitted
taprpc+rpcserver: add alt leaves to DecodedProof
1 parent 16a908b commit 36e0d12

File tree

4 files changed

+427
-387
lines changed

4 files changed

+427
-387
lines changed

rpcserver.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,7 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
17021702
txMerkleProof = p.TxMerkleProof
17031703
inclusionProof = p.InclusionProof
17041704
splitRootProof = p.SplitRootProof
1705+
altLeaves = p.AltLeaves
17051706
)
17061707

17071708
var txMerkleProofBuf bytes.Buffer
@@ -1759,6 +1760,19 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
17591760
}
17601761
}
17611762

1763+
var altLeavesBuf bytes.Buffer
1764+
if len(altLeaves) > 0 {
1765+
var scratch [8]byte
1766+
1767+
err := asset.AltLeavesEncoder(
1768+
&altLeavesBuf, &altLeaves, &scratch,
1769+
)
1770+
if err != nil {
1771+
return nil, fmt.Errorf("unable to encode alt leaves: "+
1772+
"%w", err)
1773+
}
1774+
}
1775+
17621776
rpcAsset, err := r.MarshalChainAsset(ctx, &asset.ChainAsset{
17631777
Asset: &p.Asset,
17641778
AnchorTx: &p.AnchorTx,
@@ -1838,6 +1852,7 @@ func (r *rpcServer) marshalProof(ctx context.Context, p *proof.Proof,
18381852
IsBurn: p.Asset.IsBurn(),
18391853
GenesisReveal: genesisReveal,
18401854
GroupKeyReveal: &GroupKeyReveal,
1855+
AltLeaves: altLeavesBuf.Bytes(),
18411856
}, nil
18421857
}
18431858

0 commit comments

Comments
 (0)