erigon-pulse/cmd/devnet/commands/account.go
ledgerwatch 708ea9225d
[devnet tool] single request generator (#7600)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-29 20:35:45 +01:00

31 lines
822 B
Go

package commands
import (
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/log/v3"
)
const (
addr = "0x71562b71999873DB5b286dF957af199Ec94617F7"
)
func callGetBalance(reqGen *requests.RequestGenerator, addr string, blockNum models.BlockNumber, checkBal uint64, logger log.Logger) {
logger.Info("Getting balance", "addeess", addr)
address := libcommon.HexToAddress(addr)
bal, err := requests.GetBalance(reqGen, address, blockNum, logger)
if err != nil {
logger.Error("FAILURE", "error", err)
return
}
if checkBal > 0 && checkBal != bal {
logger.Error("FAILURE => Balance mismatch", "expected", checkBal, "got", bal)
return
}
logger.Info("SUCCESS", "balance", bal)
}