parent
548bf48d7a
commit
a1867a584a
@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* (rpc) [tharsis#611](https://github.com/tharsis/ethermint/pull/611) Fix panic on JSON-RPC when querying for an invalid block height.
|
||||||
* (cmd) [tharsis#483](https://github.com/tharsis/ethermint/pull/483) Use config values on genesis accounts.
|
* (cmd) [tharsis#483](https://github.com/tharsis/ethermint/pull/483) Use config values on genesis accounts.
|
||||||
|
|
||||||
## [v0.6.0] - 2021-09-29
|
## [v0.6.0] - 2021-09-29
|
||||||
|
@ -129,6 +129,11 @@ func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return if requested block height is greater than the current one
|
||||||
|
if resBlock == nil || resBlock.Block == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx)
|
res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error())
|
e.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error())
|
||||||
@ -172,18 +177,17 @@ func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tm
|
|||||||
height = 1
|
height = 1
|
||||||
default:
|
default:
|
||||||
if blockNum < 0 {
|
if blockNum < 0 {
|
||||||
err := errors.Errorf("incorrect block height: %d", height)
|
return nil, errors.Errorf("cannot fetch a negative block height: %d", height)
|
||||||
return nil, err
|
}
|
||||||
} else if height > int64(currentBlockNumber) {
|
if height > int64(currentBlockNumber) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resBlock, err := e.clientCtx.Client.Block(e.ctx, &height)
|
resBlock, err := e.clientCtx.Client.Block(e.ctx, &height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// e.logger.Debug("GetBlockByNumber safely bumping down from %d to latest", height)
|
|
||||||
if resBlock, err = e.clientCtx.Client.Block(e.ctx, nil); err != nil {
|
if resBlock, err = e.clientCtx.Client.Block(e.ctx, nil); err != nil {
|
||||||
e.logger.Debug("GetBlockByNumber failed to get latest block", "error", err.Error())
|
e.logger.Debug("tendermint client failed to get latest block", "height", height, "error", err.Error())
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,6 +196,7 @@ func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tm
|
|||||||
e.logger.Debug("GetBlockByNumber block not found", "height", height)
|
e.logger.Debug("GetBlockByNumber block not found", "height", height)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return resBlock, nil
|
return resBlock, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user