From 2a8f640f51df9f1a131fc03024dc2ea19462a995 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 14 Apr 2022 15:21:27 -0700 Subject: [PATCH] Just cap to MaxInt64 --- .../db2/history/transaction_batch_insert_builder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/horizon/internal/db2/history/transaction_batch_insert_builder.go b/services/horizon/internal/db2/history/transaction_batch_insert_builder.go index 77816911f1..7496c138e4 100644 --- a/services/horizon/internal/db2/history/transaction_batch_insert_builder.go +++ b/services/horizon/internal/db2/history/transaction_batch_insert_builder.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/hex" "fmt" + "math" "strconv" "strings" "time" @@ -238,6 +239,11 @@ func formatDuration(d *xdr.Duration) null.Int { if d == nil { return null.Int{} } + + if *d > math.MaxInt64 { + *d = xdr.Duration(math.MaxInt64) + } + return null.IntFrom(int64(*d)) }