Skip to content

Commit

Permalink
Add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
urvisavla committed Oct 24, 2023
1 parent 29eb9cd commit dbbf206
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/horizon/internal/db2/history/claimable_balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ type ClaimableBalance struct {
type Claimants []Claimant

func (c Claimants) Value() (driver.Value, error) {
// Convert the byte array into a string as a workaround to bypass buggy encoding in the pq driver
// (More info about this bug here https://github.com/stellar/go/issues/5086#issuecomment-1773215436).
// By doing so, the data will be written as a string rather than hex encoded bytes.
// According to this https://www.postgresql.org/docs/current/datatype-json.html
// this may even improve write performance due to reduced conversion overhead.
val, err := json.Marshal(c)
return string(val), err
}
Expand Down

0 comments on commit dbbf206

Please sign in to comment.