mirror of https://github.com/status-im/evmc.git
go: Add error output to Host.GetBlockHash()
This commit is contained in:
parent
d9f7ff25f5
commit
d0bc50792a
|
@ -79,7 +79,7 @@ type HostContext interface {
|
|||
Selfdestruct(addr common.Address, beneficiary common.Address)
|
||||
GetTxContext() (gasPrice common.Hash, origin common.Address, coinbase common.Address, number int64, timestamp int64,
|
||||
gasLimit int64, difficulty common.Hash)
|
||||
GetBlockHash(number int64) common.Hash
|
||||
GetBlockHash(number int64) (common.Hash, error)
|
||||
EmitLog(addr common.Address, topics []common.Hash, data []byte)
|
||||
Call(kind CallKind,
|
||||
destination common.Address, sender common.Address, value *big.Int, input []byte, gas int64, depth int,
|
||||
|
@ -186,11 +186,8 @@ func getBlockHash(pResult *C.struct_evmc_uint256be, pCtx unsafe.Pointer, number
|
|||
idx := int((*C.struct_extended_context)(pCtx).index)
|
||||
ctx := getHostContext(idx)
|
||||
|
||||
blockhash := ctx.GetBlockHash(number)
|
||||
|
||||
// FIXME: should we instead adjust `ctx.GetBlockHash`?
|
||||
if blockhash == (common.Hash{}) {
|
||||
// All zeroes hash is considered a failure in lookup.
|
||||
blockhash, err := ctx.GetBlockHash(number)
|
||||
if err != nil {
|
||||
return C.int(0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue