Skip to content

Commit

Permalink
ARCO-205: revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Oct 1, 2024
1 parent 2794bdf commit 0c680be
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/metamorph/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ type UpdateStatus struct {
Error error `json:"-"`
CompetingTxs []string `json:"competing_txs"`
// Fields for marshalling
hashStr string
errorStr string
HashStr string `json:"hash"`
ErrorStr string `json:"error"`
}

// UnmarshalJSON Custom method to unmarshall the UpdateStatus struct
Expand All @@ -108,12 +108,12 @@ func (u *UpdateStatus) UnmarshalJSON(data []byte) error {
}

// Convert the error string back to an error if necessary
if u.errorStr != "" {
u.Error = errors.New(u.errorStr)
if u.ErrorStr != "" {
u.Error = errors.New(u.ErrorStr)
}

// Convert the hash string back to a chainhash.Hash
hash, err := chainhash.NewHashFromStr(u.hashStr)
hash, err := chainhash.NewHashFromStr(u.HashStr)
if err != nil {
return err
}
Expand All @@ -126,10 +126,10 @@ func (u *UpdateStatus) UnmarshalJSON(data []byte) error {
func (u UpdateStatus) MarshalJSON() ([]byte, error) {
type Alias UpdateStatus
if u.Error != nil {
u.errorStr = u.Error.Error() // Convert error to string for marshaling
u.ErrorStr = u.Error.Error() // Convert error to string for marshaling
}

u.hashStr = u.Hash.String() // Convert hash to string for marshaling
u.HashStr = u.Hash.String() // Convert hash to string for marshaling

return json.Marshal((*Alias)(&u))
}

0 comments on commit 0c680be

Please sign in to comment.