mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Update synchronizer and DB with last contracts updates
- API - When updating network info, handle cases where no batches exists and where no forgers exists - cli/node - Update `cfg.buidler.toml` config file to a working version - common - Add new smart contract structs and extend some existing ones to reflect updates regarding events from the smart contracts - SQL - Add new tables and extend existing ones to reflect updates regarding events from the smart contracts - db/historydb - Add functions to insert new smart contract events data - Fix unclosed rows that led to inconsistent sql driver state (replace NamedQuery by NamedExec). This fixes the error: `pq: unexpected Parse response 'C'` - db/l2db - Close rows after usage - eth - In Rollup event, introduce a new UpdateBucketsParameter when there's a SafeMode event, with `SafeMode = true` - synchronizer - synchronize new events - avoid calling `auction.CanForge` before the genesisBlock to avoid getting a revert.
This commit is contained in:
11
db/utils.go
11
db/utils.go
@@ -1,6 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"reflect"
|
||||
@@ -168,8 +169,14 @@ func SlicePtrsToSlice(slice interface{}) interface{} {
|
||||
|
||||
// Rollback an sql transaction, and log the error if it's not nil
|
||||
func Rollback(txn *sqlx.Tx) {
|
||||
err := txn.Rollback()
|
||||
if err != nil {
|
||||
if err := txn.Rollback(); err != nil {
|
||||
log.Errorw("Rollback", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
// RowsClose close the rows of an sql query, and log the errir if it's not nil
|
||||
func RowsClose(rows *sql.Rows) {
|
||||
if err := rows.Close(); err != nil {
|
||||
log.Errorw("rows.Close", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user