From dbbf2065e9e747d66dce680cc51f15f4192bcb10 Mon Sep 17 00:00:00 2001 From: Urvi Date: Fri, 20 Oct 2023 15:44:57 -0700 Subject: [PATCH] Add a comment --- services/horizon/internal/db2/history/claimable_balances.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/horizon/internal/db2/history/claimable_balances.go b/services/horizon/internal/db2/history/claimable_balances.go index a584e84080..1b9254991d 100644 --- a/services/horizon/internal/db2/history/claimable_balances.go +++ b/services/horizon/internal/db2/history/claimable_balances.go @@ -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 }