[release 1.4.5] accounts/abi/bind, eth: rely on getCode for sanity checks, not estimate and call
(cherry picked from commit 1580ec1804
)
This commit is contained in:
committed by
Jeffrey Wilcke
parent
0f6e3e873a
commit
1776c717bf
15
eth/api.go
15
eth/api.go
@ -52,15 +52,6 @@ import (
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// errNoCode is returned by call and transact operations for which the requested
|
||||
// recipient contract to operate on does not exist in the state db or does not
|
||||
// have any code associated with it (i.e. suicided).
|
||||
//
|
||||
// Please note, this error string is part of the RPC API and is expected by the
|
||||
// native contract bindings to signal this particular error. Do not change this
|
||||
// as it will break all dependent code!
|
||||
var errNoCode = errors.New("no contract code at given address")
|
||||
|
||||
const defaultGas = uint64(90000)
|
||||
|
||||
// blockByNumber is a commonly used helper function which retrieves and returns
|
||||
@ -755,12 +746,6 @@ func (s *PublicBlockChainAPI) doCall(args CallArgs, blockNr rpc.BlockNumber) (st
|
||||
}
|
||||
stateDb = stateDb.Copy()
|
||||
|
||||
// If there's no code to interact with, respond with an appropriate error
|
||||
if args.To != nil {
|
||||
if code := stateDb.GetCode(*args.To); len(code) == 0 {
|
||||
return "0x", nil, errNoCode
|
||||
}
|
||||
}
|
||||
// Retrieve the account state object to interact with
|
||||
var from *state.StateObject
|
||||
if args.From == (common.Address{}) {
|
||||
|
Reference in New Issue
Block a user