Skip to content

Commit

Permalink
updated gas estimate
Browse files Browse the repository at this point in the history
Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
  • Loading branch information
gdsoumya committed Jun 14, 2021
1 parent e2bba6b commit a591e45
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions chain/ethereum/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ import (
// order to confirm transactions with an estimated maximum delay of one block.
type GasEstimator struct {
client *Client
gasLimit uint64
}

// NewGasEstimator returns a simple gas estimator that fetches the ideal gas
// price for a ethereum transaction to be included in a block
// with minimal delay.
func NewGasEstimator(client *Client, gasLimit uint64) *GasEstimator {
func NewGasEstimator(client *Client) *GasEstimator {
return &GasEstimator{
client: client,
gasLimit: gasLimit,
}
}

Expand All @@ -31,5 +29,5 @@ func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, p
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("failed to get eth suggested gas price: %v", err)
}
return pack.NewU256FromInt(gasPrice), pack.NewU256FromUint64(gasEstimator.gasLimit), nil
return pack.NewU256FromInt(gasPrice), pack.NewU256FromInt(gasPrice), nil
}

0 comments on commit a591e45

Please sign in to comment.