mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Add StateDB ZKInputs generation for L1 & L2 Txs
This commit is contained in:
@@ -30,3 +30,28 @@ func (tx *L2Tx) Tx() *Tx {
|
||||
Type: tx.Type,
|
||||
}
|
||||
}
|
||||
|
||||
// PoolL2Tx returns the data structure of PoolL2Tx with the parameters of a
|
||||
// L2Tx filled
|
||||
func (tx *L2Tx) PoolL2Tx() *PoolL2Tx {
|
||||
return &PoolL2Tx{
|
||||
TxID: tx.TxID,
|
||||
BatchNum: tx.BatchNum,
|
||||
FromIdx: tx.FromIdx,
|
||||
ToIdx: tx.ToIdx,
|
||||
Amount: tx.Amount,
|
||||
Fee: tx.Fee,
|
||||
Nonce: tx.Nonce,
|
||||
Type: tx.Type,
|
||||
}
|
||||
}
|
||||
|
||||
// L2TxsToPoolL2Txs returns an array of []*PoolL2Tx from an array of []*L2Tx,
|
||||
// where the PoolL2Tx only have the parameters of a L2Tx filled.
|
||||
func L2TxsToPoolL2Txs(txs []*L2Tx) []*PoolL2Tx {
|
||||
var r []*PoolL2Tx
|
||||
for _, tx := range txs {
|
||||
r = append(r, tx.PoolL2Tx())
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user