rpc: fix EthLatestBlockNumber value (#300)

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Thomas Nguy 2021-07-15 20:07:23 +09:00 committed by GitHub
parent c986ef59a3
commit 6aa43305ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (
switch blockNum { switch blockNum {
case types.EthLatestBlockNumber: case types.EthLatestBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {
height = int64(currentBlockNumber - 1) height = int64(currentBlockNumber)
} }
case types.EthPendingBlockNumber: case types.EthPendingBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {
@ -241,7 +241,7 @@ func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Heade
switch blockNum { switch blockNum {
case types.EthLatestBlockNumber: case types.EthLatestBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {
height = int64(currentBlockNumber - 1) height = int64(currentBlockNumber)
} }
case types.EthPendingBlockNumber: case types.EthPendingBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {
@ -363,7 +363,7 @@ func (e *EVMBackend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.
switch blockNum { switch blockNum {
case types.EthLatestBlockNumber: case types.EthLatestBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {
height = int64(currentBlockNumber - 1) height = int64(currentBlockNumber)
} }
case types.EthPendingBlockNumber: case types.EthPendingBlockNumber:
if currentBlockNumber > 0 { if currentBlockNumber > 0 {