From d54a8c4a027dc859fd399882b9826e4cd3a89cb1 Mon Sep 17 00:00:00 2001 From: pk910 Date: Mon, 6 May 2024 22:17:12 +0200 Subject: [PATCH] fixed sql errors with pgsql --- db/deposits.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/db/deposits.go b/db/deposits.go index 984ab3cc..255fb50e 100644 --- a/db/deposits.go +++ b/db/deposits.go @@ -201,18 +201,18 @@ func GetDepositTxsFiltered(offset uint64, limit uint32, finalizedBlock uint64, f } if filter.WithOrphaned == 0 { args = append(args, finalizedBlock) - fmt.Fprintf(&sql, " %v (block_number > $%v OR orphaned = 0)", filterOp, len(args)) + fmt.Fprintf(&sql, " %v (block_number > $%v OR orphaned = false)", filterOp, len(args)) filterOp = "AND" } else if filter.WithOrphaned == 2 { args = append(args, finalizedBlock) - fmt.Fprintf(&sql, " %v (block_number < $%v AND orphaned = 1)", filterOp, len(args)) + fmt.Fprintf(&sql, " %v (block_number < $%v AND orphaned = true)", filterOp, len(args)) filterOp = "AND" } if filter.WithValid == 0 { - fmt.Fprintf(&sql, " %v valid_signature = 1", filterOp) + fmt.Fprintf(&sql, " %v valid_signature = true", filterOp) filterOp = "AND" } else if filter.WithValid == 2 { - fmt.Fprintf(&sql, " %v valid_signature = 0", filterOp) + fmt.Fprintf(&sql, " %v valid_signature = false", filterOp) filterOp = "AND" } @@ -227,7 +227,7 @@ func GetDepositTxsFiltered(offset uint64, limit uint32, finalizedBlock uint64, f null AS withdrawalcredentials, 0 AS amount, null AS signature, - 0 AS valid_signature, + false AS valid_signature, false AS orphaned, null AS tx_hash, null AS tx_sender, @@ -292,10 +292,10 @@ func GetDepositsFiltered(offset uint64, limit uint32, filter *dbtypes.DepositFil filterOp = "AND" } if filter.WithOrphaned == 0 { - fmt.Fprintf(&sql, " %v orphaned = 0", filterOp) + fmt.Fprintf(&sql, " %v orphaned = false", filterOp) filterOp = "AND" } else if filter.WithOrphaned == 2 { - fmt.Fprintf(&sql, " %v orphaned = 1", filterOp) + fmt.Fprintf(&sql, " %v orphaned = true", filterOp) filterOp = "AND" }