Remove the need to pass a transaction when upserting to known_gaps

Thanks Ian :D
This commit is contained in:
Abdul Rabbani 2022-03-22 11:52:35 -04:00
parent 2807a8953c
commit e3df60c506

View File

@ -17,6 +17,7 @@
package sql
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common"
@ -186,14 +187,12 @@ func (w *Writer) upsertStorageCID(tx Tx, storageCID models.StorageNodeModel) err
return nil
}
func (w *Writer) upsertKnownGaps(tx Tx, knownGaps models.KnownGapsModel) error {
res, err := tx.Exec(w.db.Context(), w.db.InsertKnownGapsStm(),
func (w *Writer) upsertKnownGaps(knownGaps models.KnownGapsModel) error {
_, err := w.db.Exec(context.Background(), w.db.InsertKnownGapsStm(),
knownGaps.StartingBlockNumber, knownGaps.EndingBlockNumber, knownGaps.CheckedOut, knownGaps.ProcessingKey)
if err != nil {
return fmt.Errorf("error upserting known_gaps entry: %v", err)
}
ret, _ := res.RowsAffected()
fmt.Println("Res:", ret)
return nil
}