diff --git a/zk/datastream/server/data_stream_server.go b/zk/datastream/server/data_stream_server.go index bddd671e9b9..a37f35a240c 100644 --- a/zk/datastream/server/data_stream_server.go +++ b/zk/datastream/server/data_stream_server.go @@ -193,7 +193,7 @@ func createBlockWithBatchCheckStreamEntriesProto( } // the genesis we insert fully, so we would have to skip closing it if !shouldSkipBatchEndEntry { - localExitRoot, err := utils.GetBatchLocalExitRootFromSCStorageForLatestBlock(batchNumber, reader, tx) + localExitRoot, err := utils.GetBatchLocalExitRootFromSCStorageForLatestBlock(lastBatchNumber, reader, tx) if err != nil { return nil, err } diff --git a/zk/utils/utils.go b/zk/utils/utils.go index fd69dfb7762..562c9e7f2ea 100644 --- a/zk/utils/utils.go +++ b/zk/utils/utils.go @@ -146,7 +146,7 @@ func GetBatchLocalExitRootFromSCStorageForLatestBlock(batchNo uint64, db DbReade func GetBatchLocalExitRootFromSCStorageByBlock(blockNumber uint64, db DbReader, tx kv.Tx) (libcommon.Hash, error) { if blockNumber > 0 { - stateReader := state.NewPlainState(tx, blockNumber+1, systemcontracts.SystemContractCodeLookup["hermez"]) + stateReader := state.NewPlainState(tx, blockNumber, systemcontracts.SystemContractCodeLookup["hermez"]) defer stateReader.Close() rawLer, err := stateReader.ReadAccountStorage(state.GER_MANAGER_ADDRESS, 1, &state.GLOBAL_EXIT_ROOT_POS_1) if err != nil {