internal/ethapi: return revert reason for eth_call
This commit is contained in:
parent
4b2ff1457a
commit
fd70cfe87a
|
@ -861,6 +861,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
|
|||
if evm.Cancelled() {
|
||||
return nil, fmt.Errorf("execution aborted (timeout = %v)", timeout)
|
||||
}
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
|
@ -879,6 +880,13 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Err != nil {
|
||||
reason, err := abi.UnpackRevert(result.Revert())
|
||||
if err != nil {
|
||||
return result.Return(), err
|
||||
}
|
||||
return result.Return(), errors.New(reason)
|
||||
}
|
||||
return result.Return(), nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue