removes the LRU cache in the CeloAPIBackend.GetExchangeRates call because of premature optmisation
adds a function rpc.BlockNumberOrHashEnsureHashOnly:
converts number and latest, pending, earliest, ... based block-number arguments to their hash based on the blockchain state
has extra argument flags that force the returned hash to be the block's parent hash
changes the call signature of ethapi.CeloBackend methods to accept rpc.BlockNumberOrHash instead of common.Hash for specifying blocks to query
uses rpc.BlockNumberOrHashEnsureHashOnly to convert pending RPC arguments in eth_estimateGas to the pending block's parent hash, so that state-db queries don't fail (#136)
Unfortunately the fix for #136 is not easily tested in a unit-test, since the ethapi/api_test.go's mock backend does not fully implement querying state of the pending block. We should re-evaluate in the future, if it is worth to change the mock implementation here.
Fixes #136
CeloAPIBackend.GetExchangeRates
call because of premature optmisationrpc.BlockNumberOrHashEnsureHashOnly
:latest, pending, earliest, ...
based block-number arguments to their hash based on the blockchain stateethapi.CeloBackend
methods to acceptrpc.BlockNumberOrHash
instead ofcommon.Hash
for specifying blocks to queryrpc.BlockNumberOrHashEnsureHashOnly
to convertpending
RPC arguments ineth_estimateGas
to the pending block's parent hash, so that state-db queries don't fail (#136)Unfortunately the fix for #136 is not easily tested in a unit-test, since the
ethapi/api_test.go
's mock backend does not fully implement querying state of thepending
block. We should re-evaluate in the future, if it is worth to change the mock implementation here.