mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
API change names and add poolLoad, add maxFeeUSD
This commit is contained in:
@@ -62,6 +62,10 @@ func (l2db *L2DB) AddTxAPI(tx *PoolL2TxWrite) error {
|
||||
return tracerr.Wrap(fmt.Errorf("tx.feeUSD (%v) < minFeeUSD (%v)",
|
||||
feeUSD, l2db.minFeeUSD))
|
||||
}
|
||||
if feeUSD > l2db.maxFeeUSD {
|
||||
return tracerr.Wrap(fmt.Errorf("tx.feeUSD (%v) > maxFeeUSD (%v)",
|
||||
feeUSD, l2db.maxFeeUSD))
|
||||
}
|
||||
|
||||
// Prepare insert SQL query argument parameters
|
||||
namesPart, err := meddler.Default.ColumnsQuoted(tx, false)
|
||||
|
||||
@@ -27,6 +27,7 @@ type L2DB struct {
|
||||
ttl time.Duration
|
||||
maxTxs uint32 // limit of txs that are accepted in the pool
|
||||
minFeeUSD float64
|
||||
maxFeeUSD float64
|
||||
apiConnCon *db.APIConnectionController
|
||||
}
|
||||
|
||||
@@ -38,6 +39,7 @@ func NewL2DB(
|
||||
safetyPeriod common.BatchNum,
|
||||
maxTxs uint32,
|
||||
minFeeUSD float64,
|
||||
maxFeeUSD float64,
|
||||
TTL time.Duration,
|
||||
apiConnCon *db.APIConnectionController,
|
||||
) *L2DB {
|
||||
@@ -48,6 +50,7 @@ func NewL2DB(
|
||||
ttl: TTL,
|
||||
maxTxs: maxTxs,
|
||||
minFeeUSD: minFeeUSD,
|
||||
maxFeeUSD: maxFeeUSD,
|
||||
apiConnCon: apiConnCon,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
l2DB = NewL2DB(db, db, 10, 1000, 0.0, 24*time.Hour, nil)
|
||||
l2DB = NewL2DB(db, db, 10, 1000, 0.0, 1000.0, 24*time.Hour, nil)
|
||||
apiConnCon := dbUtils.NewAPIConnectionController(1, time.Second)
|
||||
l2DBWithACC = NewL2DB(db, db, 10, 1000, 0.0, 24*time.Hour, apiConnCon)
|
||||
l2DBWithACC = NewL2DB(db, db, 10, 1000, 0.0, 1000.0, 24*time.Hour, apiConnCon)
|
||||
test.WipeDB(l2DB.DB())
|
||||
historyDB = historydb.NewHistoryDB(db, db, nil)
|
||||
// Run tests
|
||||
|
||||
Reference in New Issue
Block a user