mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
Stop using stateDB in API
This commit is contained in:
@@ -206,9 +206,8 @@ type SCConsts struct {
|
||||
|
||||
// Config is the Synchronizer configuration
|
||||
type Config struct {
|
||||
StatsRefreshPeriod time.Duration
|
||||
StoreAccountUpdates bool
|
||||
ChainID uint16
|
||||
StatsRefreshPeriod time.Duration
|
||||
ChainID uint16
|
||||
}
|
||||
|
||||
// Synchronizer implements the Synchronizer type
|
||||
@@ -994,19 +993,17 @@ func (s *Synchronizer) rollupSync(ethBlock *common.Block) (*common.RollupData, e
|
||||
}
|
||||
batchData.CreatedAccounts = processTxsOut.CreatedAccounts
|
||||
|
||||
if s.cfg.StoreAccountUpdates {
|
||||
batchData.UpdatedAccounts = make([]common.AccountUpdate, 0,
|
||||
len(processTxsOut.UpdatedAccounts))
|
||||
for _, acc := range processTxsOut.UpdatedAccounts {
|
||||
batchData.UpdatedAccounts = append(batchData.UpdatedAccounts,
|
||||
common.AccountUpdate{
|
||||
EthBlockNum: blockNum,
|
||||
BatchNum: batchNum,
|
||||
Idx: acc.Idx,
|
||||
Nonce: acc.Nonce,
|
||||
Balance: acc.Balance,
|
||||
})
|
||||
}
|
||||
batchData.UpdatedAccounts = make([]common.AccountUpdate, 0,
|
||||
len(processTxsOut.UpdatedAccounts))
|
||||
for _, acc := range processTxsOut.UpdatedAccounts {
|
||||
batchData.UpdatedAccounts = append(batchData.UpdatedAccounts,
|
||||
common.AccountUpdate{
|
||||
EthBlockNum: blockNum,
|
||||
BatchNum: batchNum,
|
||||
Idx: acc.Idx,
|
||||
Nonce: acc.Nonce,
|
||||
Balance: acc.Balance,
|
||||
})
|
||||
}
|
||||
|
||||
slotNum := int64(0)
|
||||
|
||||
@@ -346,8 +346,7 @@ func TestSyncGeneral(t *testing.T) {
|
||||
|
||||
// Create Synchronizer
|
||||
s, err := NewSynchronizer(client, historyDB, stateDB, Config{
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
StoreAccountUpdates: true,
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -738,8 +737,7 @@ func TestSyncForgerCommitment(t *testing.T) {
|
||||
|
||||
// Create Synchronizer
|
||||
s, err := NewSynchronizer(client, historyDB, stateDB, Config{
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
StoreAccountUpdates: true,
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -839,8 +837,7 @@ func TestSyncForgerCommitment(t *testing.T) {
|
||||
syncCommitment[syncBlock.Block.Num] = stats.Sync.Auction.CurrentSlot.ForgerCommitment
|
||||
|
||||
s2, err := NewSynchronizer(client, historyDB, stateDB, Config{
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
StoreAccountUpdates: true,
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
stats = s2.Stats()
|
||||
|
||||
Reference in New Issue
Block a user