Skip to content

Commit

Permalink
remove header stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
gatsbyz committed Jun 28, 2023
1 parent 04e19a4 commit 48024aa
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions cmd/loadtest/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ func blockUntilSuccessful(ctx context.Context, c *ethclient.Client, f func() err
}
}

func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64, header *ethtypes.Header) (t1 time.Time, t2 time.Time, err error) {
func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64, head *ethtypes.Header) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

gasPrice := ltp.CurrentGas
Expand All @@ -972,20 +972,14 @@ func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64,
chainID := new(big.Int).SetUint64(*ltp.ChainID)
privateKey := ltp.ECDSAPrivateKey

head, err := c.HeaderByNumber(ctx, nil)
if err != nil {
log.Error().Err(err).Msg("Unable to get head")
return
}

gasLimit := uint64(21000)
var tx *ethtypes.Transaction
if *ltp.LegacyTransactionMode {
tx = ethtypes.NewTransaction(nonce, *to, amount, gasLimit, gasPrice, nil)
} else {
gasTipCap := ltp.CurrentGasTipCap
gasFeeCap := new(big.Int).Add(gasTipCap, head.BaseFee)
baseTx := &ethtypes.DynamicFeeTx{
dynamicFeeTx := &ethtypes.DynamicFeeTx{
ChainID: chainID,
Nonce: nonce,
To: to,
Expand All @@ -995,7 +989,7 @@ func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64,
Data: nil,
Value: amount,
}
tx = ethtypes.NewTx(baseTx)
tx = ethtypes.NewTx(dynamicFeeTx)
}

tops, err := bind.NewKeyedTransactorWithChainID(privateKey, chainID)
Expand Down

0 comments on commit 48024aa

Please sign in to comment.