internal/ethapi: check if require reason can be unpacked
This commit is contained in:
committed by
Péter Szilágyi
parent
05eb3d5f0f
commit
92bee6b037
@ -361,7 +361,7 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallM
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// If the result contains a revert reason, unpack and return it.
|
// If the result contains a revert reason, unpack and return it.
|
||||||
if res.Err != nil {
|
if res.Err != nil && len(res.Revert()) > 0 {
|
||||||
reason, err := abi.UnpackRevert(res.Revert())
|
reason, err := abi.UnpackRevert(res.Revert())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -382,7 +382,7 @@ func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call ethereu
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// If the result contains a revert reason, unpack and return it.
|
// If the result contains a revert reason, unpack and return it.
|
||||||
if res.Err != nil {
|
if res.Err != nil && len(res.Revert()) > 0 {
|
||||||
reason, err := abi.UnpackRevert(res.Revert())
|
reason, err := abi.UnpackRevert(res.Revert())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -862,7 +862,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
|
|||||||
return nil, fmt.Errorf("execution aborted (timeout = %v)", timeout)
|
return nil, fmt.Errorf("execution aborted (timeout = %v)", timeout)
|
||||||
}
|
}
|
||||||
// If the result contains a revert reason, unpack and return it.
|
// If the result contains a revert reason, unpack and return it.
|
||||||
if result.Err != nil {
|
if result.Err != nil && len(result.Revert()) > 0 {
|
||||||
reason, err := abi.UnpackRevert(result.Revert())
|
reason, err := abi.UnpackRevert(result.Revert())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user