accounts/abi/bind/backends: fix EstimateGas
This commit is contained in:
parent
7cdf4eea7e
commit
53508c5d46
|
@ -509,13 +509,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
|
|||
if failed {
|
||||
if result != nil && result.Err != vm.ErrOutOfGas {
|
||||
if len(result.Revert()) > 0 {
|
||||
reason, err := abi.UnpackRevert(result.Revert())
|
||||
if err == nil {
|
||||
return 0, &revertError{
|
||||
error: errors.New("execution reverted"),
|
||||
errData: reason,
|
||||
}
|
||||
}
|
||||
return 0, newRevertError(result)
|
||||
}
|
||||
return 0, result.Err
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ func TestSimulatedBackend_EstimateGas(t *testing.T) {
|
|||
GasPrice: big.NewInt(0),
|
||||
Value: nil,
|
||||
Data: common.Hex2Bytes("d8b98391"),
|
||||
}, 0, errors.New("execution reverted"), "revert reason"},
|
||||
}, 0, errors.New("execution reverted: revert reason"), "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d72657665727420726561736f6e00000000000000000000000000000000000000"},
|
||||
|
||||
{"PureRevert", ethereum.CallMsg{
|
||||
From: addr,
|
||||
|
|
Loading…
Reference in New Issue