Skip to content

Commit

Permalink
fixed sql errors with pgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed May 6, 2024
1 parent 3658723 commit d54a8c4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions db/deposits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -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,
Expand Down Expand Up @@ -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"
}

Expand Down

0 comments on commit d54a8c4

Please sign in to comment.