|
|
@ -52,7 +52,7 @@ func NewTxSelector(synchronizerStateDB *statedb.StateDB, l2 *l2db.L2DB, maxL1Use |
|
|
|
|
|
|
|
// Reset tells the TxSelector to get it's internal AccountsDB
|
|
|
|
// from the required `batchNum`
|
|
|
|
func (txsel *TxSelector) Reset(batchNum int) error { |
|
|
|
func (txsel *TxSelector) Reset(batchNum uint64) error { |
|
|
|
err := txsel.localAccountsDB.Reset(batchNum, true) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
@ -61,7 +61,7 @@ func (txsel *TxSelector) Reset(batchNum int) error { |
|
|
|
} |
|
|
|
|
|
|
|
// GetL2TxSelection returns a selection of the L2Txs for the next batch, from the L2DB pool
|
|
|
|
func (txsel *TxSelector) GetL2TxSelection(batchNum int) ([]common.PoolL2Tx, error) { |
|
|
|
func (txsel *TxSelector) GetL2TxSelection(batchNum uint64) ([]common.PoolL2Tx, error) { |
|
|
|
// get pending l2-tx from tx-pool
|
|
|
|
l2TxsRaw, err := txsel.l2db.GetPendingTxs() // once l2db ready, maybe use parameter 'batchNum'
|
|
|
|
if err != nil { |
|
|
@ -90,7 +90,7 @@ func (txsel *TxSelector) GetL2TxSelection(batchNum int) ([]common.PoolL2Tx, erro |
|
|
|
} |
|
|
|
|
|
|
|
// GetL1L2TxSelection returns the selection of L1 + L2 txs
|
|
|
|
func (txsel *TxSelector) GetL1L2TxSelection(batchNum int, l1txs []common.Tx) ([]common.Tx, []common.PoolL2Tx, []common.Tx, error) { |
|
|
|
func (txsel *TxSelector) GetL1L2TxSelection(batchNum uint64, l1txs []common.L1Tx) ([]common.L1Tx, []common.L1Tx, []common.PoolL2Tx, error) { |
|
|
|
// apply l1-user-tx to localAccountDB
|
|
|
|
// create new leaves
|
|
|
|
// update balances
|
|
|
@ -134,7 +134,7 @@ func (txsel *TxSelector) GetL1L2TxSelection(batchNum int, l1txs []common.Tx) ([] |
|
|
|
maxL2Txs := txsel.MaxTxs - uint64(len(l1OperatorTxs)) // - len(l1UserTxs)
|
|
|
|
l2txs := txsel.getL2Profitable(validTxs, maxL2Txs) |
|
|
|
|
|
|
|
return l1txs, l2txs, l1OperatorTxs, nil |
|
|
|
return l1txs, l1OperatorTxs, l2txs, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (txsel *TxSelector) checkIfAccountExistOrPending(idx common.Idx) bool { |
|
|
@ -155,7 +155,7 @@ func (txsel *TxSelector) getL2Profitable(txs txs, max uint64) txs { |
|
|
|
sort.Sort(txs) |
|
|
|
return txs[:max] |
|
|
|
} |
|
|
|
func (txsel *TxSelector) createL1OperatorTxForL2Tx(accounts []common.Account) []common.Tx { |
|
|
|
func (txsel *TxSelector) createL1OperatorTxForL2Tx(accounts []common.Account) []common.L1Tx { |
|
|
|
//
|
|
|
|
return nil |
|
|
|
} |