erigon-pulse/cmd/devnet/requests/tx.go
Alex Sharov a8e8bf4528
remove simd lib, because it doesn't work with ghcr.io/goreleaser/goreleaser-cross (which producing release binaries) (#7229)
@shyba hi, seems this lib doesn't work with
ghcr.io/goreleaser/goreleaser-cross (which producing release binaries)
removing it for now, feel free to add it in future - if can make it work
with goreleaser-cross
see: https://github.com/ledgerwatch/erigon/issues/7210
2023-03-31 05:07:43 +00:00

52 lines
1.2 KiB
Go

package requests
import (
"fmt"
"github.com/ledgerwatch/erigon/cmd/rpctest/rpctest"
)
func TxpoolContent(reqId int) (int, int, int, error) {
var (
b rpctest.EthTxPool
pending map[string]interface{}
queued map[string]interface{}
baseFee map[string]interface{}
)
reqGen := initialiseRequestGenerator(reqId)
if res := reqGen.Erigon("txpool_content", reqGen.TxpoolContent(), &b); res.Err != nil {
return len(pending), len(queued), len(baseFee), fmt.Errorf("failed to fetch txpool content: %v", res.Err)
}
resp := b.Result.(map[string]interface{})
pendingLen := 0
queuedLen := 0
baseFeeLen := 0
if resp["pending"] != nil {
pending = resp["pending"].(map[string]interface{})
for _, txs := range pending { // iterate over senders
pendingLen += len(txs.(map[string]interface{}))
}
}
if resp["queue"] != nil {
queued = resp["queue"].(map[string]interface{})
for _, txs := range queued {
queuedLen += len(txs.(map[string]interface{}))
}
}
if resp["baseFee"] != nil {
baseFee = resp["baseFee"].(map[string]interface{})
for _, txs := range baseFee {
baseFeeLen += len(txs.(map[string]interface{}))
}
}
return pendingLen, queuedLen, baseFeeLen, nil
}