erigon-pulse/cmd/rpctest/rpctest/bench5.go
b00ris eb46dd68df
Account range testing (#938)
* save state

* save state

* save new timeouts

* compare passed

* save state

* cleanup
2020-08-19 07:33:49 +01:00

40 lines
820 B
Go

package rpctest
import (
"bufio"
"fmt"
"net/http"
"os"
"time"
)
func Bench5(turbogethURL string) {
var client = &http.Client{
Timeout: time.Second * 600,
}
file, err := os.Open("txs.txt")
if err != nil {
panic(err)
}
req_id := 0
template := `{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x%s"],"id":%d}`
var receipt EthReceipt
scanner := bufio.NewScanner(file)
for scanner.Scan() {
req_id++
if err = post(client, turbogethURL, fmt.Sprintf(template, scanner.Text(), req_id), &receipt); err != nil {
fmt.Printf("Count not get receipt: %s: %v\n", scanner.Text(), err)
return
}
if receipt.Error != nil {
fmt.Printf("Error getting receipt: %d %s\n", receipt.Error.Code, receipt.Error.Message)
return
}
}
err = scanner.Err()
if err != nil {
panic(err)
}
}