mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Feature/merge history l2 tables (#156)
* WIP rebase * Combine both SQL DBs * API and DB refactor
This commit is contained in:
@@ -397,7 +397,9 @@ func (s *Synchronizer) rollupSync(blockNum int64) (*rollupData, error) {
|
||||
l1CoordinatorTx.TxID = common.TxID(common.Hash([]byte("0x01" + strconv.FormatInt(int64(nextForgeL1TxsNum), 10) + strconv.FormatInt(int64(l1CoordinatorTx.Position), 10) + "00")))
|
||||
l1CoordinatorTx.UserOrigin = false
|
||||
l1CoordinatorTx.EthBlockNum = blockNum
|
||||
l1CoordinatorTx.BatchNum = common.BatchNum(fbEvent.BatchNum)
|
||||
bn := new(common.BatchNum)
|
||||
*bn = common.BatchNum(fbEvent.BatchNum)
|
||||
l1CoordinatorTx.BatchNum = bn
|
||||
|
||||
batchData.l1CoordinatorTxs = append(batchData.l1CoordinatorTxs, l1CoordinatorTx)
|
||||
|
||||
@@ -571,7 +573,6 @@ func getL1UserTx(l1UserTxEvents []eth.RollupEventL1UserTx, blockNum int64) []*co
|
||||
eL1UserTx.L1Tx.Position = eL1UserTx.Position
|
||||
eL1UserTx.L1Tx.UserOrigin = true
|
||||
eL1UserTx.L1Tx.EthBlockNum = blockNum
|
||||
eL1UserTx.L1Tx.BatchNum = 0
|
||||
|
||||
l1Txs = append(l1Txs, &eL1UserTx.L1Tx)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package synchronizer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
dbUtils "github.com/hermeznetwork/hermez-node/db"
|
||||
"github.com/hermeznetwork/hermez-node/db/historydb"
|
||||
"github.com/hermeznetwork/hermez-node/db/statedb"
|
||||
"github.com/hermeznetwork/hermez-node/eth"
|
||||
@@ -24,8 +24,9 @@ func Test(t *testing.T) {
|
||||
|
||||
// Init History DB
|
||||
pass := os.Getenv("POSTGRES_PASS")
|
||||
historyDB, err := historydb.NewHistoryDB(5432, "localhost", "hermez", pass, "history")
|
||||
db, err := dbUtils.InitSQLDB(5432, "localhost", "hermez", pass, "hermez")
|
||||
require.Nil(t, err)
|
||||
historyDB := historydb.NewHistoryDB(db)
|
||||
err = historyDB.Reorg(0)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -65,9 +66,4 @@ func Test(t *testing.T) {
|
||||
err = s.Sync()
|
||||
require.Nil(t, err)
|
||||
*/
|
||||
|
||||
// Close History DB
|
||||
if err := historyDB.Close(); err != nil {
|
||||
fmt.Println("Error closing the history DB:", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user