mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Add initial structure Coordinator Forge Sequence
This commit is contained in:
@@ -4,11 +4,16 @@ import (
|
||||
"github.com/hermeznetwork/hermez-node/common"
|
||||
)
|
||||
|
||||
type Proof struct {
|
||||
// TBD this type will be got from the proof server
|
||||
}
|
||||
|
||||
// BatchInfo contans the Batch information
|
||||
type BatchInfo struct {
|
||||
batchNum uint64
|
||||
serverProof *ServerProofInfo
|
||||
zkInputs *common.ZKInputs
|
||||
proof *Proof
|
||||
L1UserTxsExtra []common.L1Tx
|
||||
L1OperatorTxs []common.L1Tx
|
||||
L2Txs []common.PoolL2Tx
|
||||
@@ -24,30 +29,41 @@ func NewBatchInfo(batchNum uint64, serverProof *ServerProofInfo) BatchInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// AddTxsInfo adds the l1UserTxs, l1OperatorTxs and l2Txs to the BatchInfo data
|
||||
// SetTxsInfo sets the l1UserTxs, l1OperatorTxs and l2Txs to the BatchInfo data
|
||||
// structure
|
||||
func (bi *BatchInfo) AddTxsInfo(l1UserTxsExtra, l1OperatorTxs []common.L1Tx, l2Txs []common.PoolL2Tx) {
|
||||
func (bi *BatchInfo) SetTxsInfo(l1UserTxsExtra, l1OperatorTxs []common.L1Tx, l2Txs []common.PoolL2Tx) {
|
||||
// TBD parameter: feesInfo
|
||||
bi.L1UserTxsExtra = l1UserTxsExtra
|
||||
bi.L1OperatorTxs = l1OperatorTxs
|
||||
bi.L2Txs = l2Txs
|
||||
}
|
||||
|
||||
// AddTxsInfo adds the ZKInputs to the BatchInfo data structure
|
||||
func (bi *BatchInfo) AddZKInputs(zkInputs *common.ZKInputs) {
|
||||
// SetZKInputs sets the ZKInputs to the BatchInfo data structure
|
||||
func (bi *BatchInfo) SetZKInputs(zkInputs *common.ZKInputs) {
|
||||
bi.zkInputs = zkInputs
|
||||
}
|
||||
|
||||
// AddTxsInfo adds the ServerProofInfo to the BatchInfo data structure
|
||||
func (bi *BatchInfo) AddServerProof(serverProof *ServerProofInfo) {
|
||||
// SetServerProof sets the ServerProofInfo to the BatchInfo data structure
|
||||
func (bi *BatchInfo) SetServerProof(serverProof *ServerProofInfo) {
|
||||
bi.serverProof = serverProof
|
||||
}
|
||||
|
||||
// SetProof sets the Proof to the BatchInfo data structure
|
||||
func (bi *BatchInfo) SetProof(proof *Proof) {
|
||||
bi.proof = proof
|
||||
}
|
||||
|
||||
// BatchQueue implements a FIFO queue of BatchInfo
|
||||
type BatchQueue struct {
|
||||
queue []*BatchInfo
|
||||
}
|
||||
|
||||
func NewBatchQueue() *BatchQueue {
|
||||
return &BatchQueue{
|
||||
queue: []*BatchInfo{},
|
||||
}
|
||||
}
|
||||
|
||||
// Push adds the given BatchInfo to the BatchQueue
|
||||
func (bq *BatchQueue) Push(b *BatchInfo) {
|
||||
bq.queue = append(bq.queue, b)
|
||||
|
||||
Reference in New Issue
Block a user