mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Set EffectiveAmount and EffectiveLoadAmount of forged L1UserTxs
This commit is contained in:
@@ -690,6 +690,36 @@ func (tc *Context) FillBlocksL1UserTxsBatchNum(blocks []common.BlockData) {
|
||||
}
|
||||
}
|
||||
|
||||
// FillBlocksForgedL1UserTxs fills the L1UserTxs of a batch with the L1UserTxs
|
||||
// that are forged in that batch. It always sets `EffectiveAmount` = `Amount`
|
||||
// and `EffectiveLoadAmount` = `LoadAmount`.
|
||||
func (tc *Context) FillBlocksForgedL1UserTxs(blocks []common.BlockData) error {
|
||||
for i := range blocks {
|
||||
block := &blocks[i]
|
||||
for j := range block.Rollup.Batches {
|
||||
batch := &block.Rollup.Batches[j]
|
||||
if batch.L1Batch {
|
||||
batchNum := batch.Batch.BatchNum
|
||||
queue := tc.Queues[int(*batch.Batch.ForgeL1TxsNum)]
|
||||
batch.L1UserTxs = make([]common.L1Tx, len(queue))
|
||||
for k := range queue {
|
||||
tx := &batch.L1UserTxs[k]
|
||||
*tx = queue[k].L1Tx
|
||||
tx.EffectiveAmount = tx.Amount
|
||||
tx.EffectiveLoadAmount = tx.LoadAmount
|
||||
tx.BatchNum = &batchNum
|
||||
_tx, err := common.NewL1Tx(tx)
|
||||
if err != nil {
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
*tx = *_tx
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FillBlocksExtra fills extra fields not generated by til in each block, so
|
||||
// that the blockData is closer to what the HistoryDB stores. The filled fields are:
|
||||
// - blocks[].Rollup.Batch.EthBlockNum
|
||||
|
||||
Reference in New Issue
Block a user