@@ -3,17 +3,18 @@ package loadtest
33import (
44 "context"
55 "encoding/json"
6+ "math/big"
7+ "strings"
8+
69 "github.com/0xPolygon/polygon-cli/rpctypes"
710 "github.com/0xPolygon/polygon-cli/util"
811 ethtypes "github.com/ethereum/go-ethereum/core/types"
912 "github.com/ethereum/go-ethereum/ethclient"
1013 ethrpc "github.com/ethereum/go-ethereum/rpc"
11- "math/big"
12- "strings"
1314)
1415
1516// TODO allow this to be pre-specified with an input file
16- func getRecentBlocks (ctx context.Context , ec * ethclient.Client , c * ethrpc.Client ) ([]* json.RawMessage , error ) {
17+ func getRecentBlocks (ctx context.Context , ec * ethclient.Client , c * ethrpc.Client , onlyTxHashes bool ) ([]* json.RawMessage , error ) {
1718 bn , err := ec .BlockNumber (ctx )
1819 if err != nil {
1920 return nil , err
@@ -22,12 +23,12 @@ func getRecentBlocks(ctx context.Context, ec *ethclient.Client, c *ethrpc.Client
2223 // FIXME the batch size of 25 is hard coded and probably should at least be a constant or a parameter. This limit is
2324 // different than the actual json RPC batch size of 999. Because we're fetching blocks, its' more likely that we hit
2425 // a response size limit rather than a batch length limit
25- rawBlocks , err := util .GetBlockRangeInPages (ctx , bn - inputLoadTestParams .RecallLength , bn , 25 , c )
26+ rawBlocks , err := util .GetBlockRangeInPages (ctx , bn - inputLoadTestParams .RecallLength , bn , 25 , c , onlyTxHashes )
2627 return rawBlocks , err
2728}
2829
2930func getRecallTransactions (ctx context.Context , c * ethclient.Client , rpc * ethrpc.Client ) ([]rpctypes.PolyTransaction , error ) {
30- rb , err := getRecentBlocks (ctx , c , rpc )
31+ rb , err := getRecentBlocks (ctx , c , rpc , false )
3132 if err != nil {
3233 return nil , err
3334 }
@@ -60,7 +61,7 @@ type IndexedActivity struct {
6061}
6162
6263func getIndexedRecentActivity (ctx context.Context , ec * ethclient.Client , c * ethrpc.Client ) (* IndexedActivity , error ) {
63- blockData , err := getRecentBlocks (ctx , ec , c )
64+ blockData , err := getRecentBlocks (ctx , ec , c , false )
6465 if err != nil {
6566 return nil , err
6667 }
0 commit comments