mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
Verify stateroot at sync
This commit is contained in:
@@ -929,9 +929,15 @@ func (s *Synchronizer) rollupSync(ethBlock *common.Block) (*common.RollupData, e
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
if s.stateDB.CurrentBatch() != batchNum {
|
||||
return nil, tracerr.Wrap(fmt.Errorf("stateDB.BatchNum (%v) != evtForgeBatch.BatchNum = (%v)",
|
||||
return nil, tracerr.Wrap(fmt.Errorf("stateDB.BatchNum (%v) != "+
|
||||
"evtForgeBatch.BatchNum = (%v)",
|
||||
s.stateDB.CurrentBatch(), batchNum))
|
||||
}
|
||||
if s.stateDB.MT.Root().BigInt().Cmp(forgeBatchArgs.NewStRoot) != 0 {
|
||||
return nil, tracerr.Wrap(fmt.Errorf("stateDB.MTRoot (%v) != "+
|
||||
"forgeBatchArgs.NewStRoot (%v)",
|
||||
s.stateDB.MT.Root().BigInt(), forgeBatchArgs.NewStRoot))
|
||||
}
|
||||
|
||||
// Transform processed PoolL2 txs to L2 and store in BatchData
|
||||
l2Txs, err := common.PoolL2TxsToL2Txs(poolL2Txs) // NOTE: This is a big uggly, find a better way
|
||||
|
||||
Reference in New Issue
Block a user