Skip to content

Commit

Permalink
simplify GetSlotsByRoots
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Aug 23, 2024
1 parent 8ded7b5 commit 8a772a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions db/slots.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ func GetSlotsByRoots(roots [][]byte) map[phase0.Root]*dbtypes.Slot {
argIdx += 1
}

var sql strings.Builder
fmt.Fprintf(&sql,
sql := fmt.Sprintf(
`SELECT
root, slot, parent_root, state_root, status, proposer, graffiti, graffiti_text,
attestation_count, deposit_count, exit_count, withdraw_count, withdraw_amount, attester_slashing_count,
Expand All @@ -177,7 +176,7 @@ func GetSlotsByRoots(roots [][]byte) map[phase0.Root]*dbtypes.Slot {
)

slots := []*dbtypes.Slot{}
err := ReaderDb.Select(&slots, sql.String(), args...)
err := ReaderDb.Select(&slots, sql, args...)
if err != nil {
logger.Errorf("Error while fetching block by roots: %v", err)
return nil
Expand Down

0 comments on commit 8a772a2

Please sign in to comment.