2023-01-10 17:43:58 +00:00
|
|
|
package services
|
2022-10-11 12:34:32 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ledgerwatch/erigon/cmd/devnet/models"
|
|
|
|
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
|
2023-05-20 20:57:32 +00:00
|
|
|
"github.com/ledgerwatch/log/v3"
|
2022-10-11 12:34:32 +00:00
|
|
|
)
|
|
|
|
|
2023-05-20 20:57:32 +00:00
|
|
|
func CheckTxPoolContent(expectedPendingSize, expectedQueuedSize, expectedBaseFeeSize int, logger log.Logger) {
|
|
|
|
pendingSize, queuedSize, baseFeeSize, err := requests.TxpoolContent(models.ReqId, logger)
|
2022-11-03 02:45:36 +00:00
|
|
|
if err != nil {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE getting txpool content", "error", err)
|
2022-11-22 13:28:53 +00:00
|
|
|
return
|
2022-10-11 12:34:32 +00:00
|
|
|
}
|
2022-11-03 02:45:36 +00:00
|
|
|
|
|
|
|
if pendingSize != expectedPendingSize {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE mismatched pending subpool size", "expected", expectedPendingSize, "got", pendingSize)
|
2023-01-10 17:43:58 +00:00
|
|
|
return
|
2022-11-03 02:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if queuedSize != expectedQueuedSize {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE mismatched queued subpool size", "expected", expectedQueuedSize, "got", queuedSize)
|
2023-01-10 17:43:58 +00:00
|
|
|
return
|
2022-11-03 02:45:36 +00:00
|
|
|
}
|
|
|
|
|
2023-03-30 21:49:28 +00:00
|
|
|
if baseFeeSize != expectedBaseFeeSize {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE mismatched basefee subpool size", "expected", expectedBaseFeeSize, "got", baseFeeSize)
|
2023-03-30 21:49:28 +00:00
|
|
|
}
|
|
|
|
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Info("SUCCESS => subpool sizes", "pending", pendingSize, "queued", queuedSize, "basefee", baseFeeSize)
|
2022-10-11 12:34:32 +00:00
|
|
|
}
|