2023-01-10 17:43:58 +00:00
package services
2022-10-11 12:34:32 +00:00
import (
"fmt"
2022-11-22 13:28:53 +00:00
2022-10-11 12:34:32 +00:00
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
)
2023-03-30 21:49:28 +00:00
func CheckTxPoolContent ( expectedPendingSize , expectedQueuedSize , expectedBaseFeeSize int ) {
pendingSize , queuedSize , baseFeeSize , err := requests . TxpoolContent ( models . ReqId )
2022-11-03 02:45:36 +00:00
if err != nil {
fmt . Printf ( "FAILURE => error getting txpool content: %v\n" , 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 {
fmt . Printf ( "FAILURE => %v\n" , fmt . Errorf ( "expected %d transaction(s) in pending pool, got %d" , expectedPendingSize , pendingSize ) )
2023-01-10 17:43:58 +00:00
return
2022-11-03 02:45:36 +00:00
}
if queuedSize != expectedQueuedSize {
fmt . Printf ( "FAILURE => %v\n" , fmt . Errorf ( "expected %d transaction(s) in queued pool, got %d" , expectedQueuedSize , 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 {
fmt . Printf ( "FAILURE => %v\n" , fmt . Errorf ( "expected %d transaction(s) in baseFee pool, got %d" , expectedBaseFeeSize , baseFeeSize ) )
}
fmt . Printf ( "SUCCESS => %d transaction(s) in the pending pool, %d transaction(s) in the queued pool and %d transaction(s) in the baseFee pool\n" , pendingSize , queuedSize , baseFeeSize )
2022-10-11 12:34:32 +00:00
}