Skip to content

Commit

Permalink
Changed BlobProof.Nodes field type to [][]byte
Browse files Browse the repository at this point in the history
  • Loading branch information
k-karuna committed Dec 9, 2024
1 parent a077b98 commit 3a5058d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions cmd/api/handler/responses/blobProof.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@
package responses

import (
"encoding/base64"
"github.com/celestiaorg/celestia-app/v3/pkg/proof"
)

type BlobProof struct {
Start int32 `example:"0" format:"integer" json:"start" swaggertype:"integer"`
End int32 `example:"16" format:"integer" json:"end" swaggertype:"integer"`
Nodes []string `json:"nodes"`
Nodes [][]byte `json:"nodes"`
}

func NewProofs(proofs []*proof.NMTProof) []BlobProof {
result := make([]BlobProof, len(proofs))

for i := range proofs {
proofNodes := make([]string, len(proofs[i].Nodes))
for j, node := range proofs[i].Nodes {
proofNodes[j] = base64.StdEncoding.EncodeToString(node)
}

result[i] = BlobProof{
Start: proofs[i].Start,
End: proofs[i].End,
Nodes: proofNodes,
Nodes: proofs[i].Nodes,
}
}
return result
Expand Down

0 comments on commit 3a5058d

Please sign in to comment.