Skip to content

Commit

Permalink
switch to marshalling whole type
Browse files Browse the repository at this point in the history
  • Loading branch information
zvolin committed Nov 13, 2024
1 parent f7c01f3 commit 8422d77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions blob/commitment_proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,16 @@ func (commitmentProof *CommitmentProof) Verify(root []byte, subtreeRootThreshold

// MarshalJSON marshals an CommitmentProof to JSON. Uses tendermint encoder for row proof for compatibility.
func (c *CommitmentProof) MarshalJSON() ([]byte, error) {
// alias the type to avoid going into recursion loop
// because tmjson.Marshal invokes custom json Marshalling
type Alias CommitmentProof
return tmjson.Marshal((*Alias)(c))
}

// UnmarshalJSON unmarshals an CommitmentProof from JSON. Uses tendermint decoder for row proof for compatibility.
func (c *CommitmentProof) UnmarshalJSON(data []byte) error {
// alias the type to avoid going into recursion loop
// because tmjson.Unmarshal invokes custom json Unmarshalling
type Alias CommitmentProof
return tmjson.Unmarshal(data, (*Alias)(c))
}

0 comments on commit 8422d77

Please sign in to comment.