TxProcessor put ExitInfos computation inside TypeSynchronizer logic to avoid computing it for TypeBatchBuilder case

This commit is contained in:
arnaucube
2021-02-16 17:06:26 +01:00
parent e2376980f8
commit 2c72166aab

View File

@@ -405,8 +405,9 @@ func (tp *TxProcessor) ProcessTxs(coordIdxs []common.Idx, l1usertxs, l1coordinat
return nil, nil return nil, nil
} }
// once all txs processed (exitTree root frozen), for each Exit, if tp.s.Type() == statedb.TypeSynchronizer {
// generate common.ExitInfo data // once all txs processed (exitTree root frozen), for each
// Exit, generate common.ExitInfo data
var exitInfos []common.ExitInfo var exitInfos []common.ExitInfo
exitInfosByIdx := make(map[common.Idx]*common.ExitInfo) exitInfosByIdx := make(map[common.Idx]*common.ExitInfo)
for i := 0; i < nTx; i++ { for i := 0; i < nTx; i++ {
@@ -436,9 +437,9 @@ func (tp *TxProcessor) ProcessTxs(coordIdxs []common.Idx, l1usertxs, l1coordinat
} }
} }
if tp.s.Type() == statedb.TypeSynchronizer { // return exitInfos, createdAccounts and collectedFees, so
// retuTypeexitInfos, createdAccounts and collectedFees, so Synchronizer will // Synchronizer will be able to store it into HistoryDB for the
// be able to store it into HistoryDB for the concrete BatchNum // concrete BatchNum
return &ProcessTxOutput{ return &ProcessTxOutput{
ZKInputs: nil, ZKInputs: nil,
ExitInfos: exitInfos, ExitInfos: exitInfos,