Fix block gas limit return for dev tooling (#150)

* cap formatted -1 value of tendermint block gas limit

* return blank miner address for dev tooling checks
This commit is contained in:
Austin Abell 2019-11-07 13:02:35 -05:00 committed by GitHub
parent 021c9f440a
commit 1f51b73d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,7 +541,7 @@ func formatBlock(
"logsBloom": bloom, "logsBloom": bloom,
"transactionsRoot": hexutil.Bytes(header.DataHash), "transactionsRoot": hexutil.Bytes(header.DataHash),
"stateRoot": hexutil.Bytes(header.AppHash), "stateRoot": hexutil.Bytes(header.AppHash),
"miner": hexutil.Bytes(header.ValidatorsHash), "miner": common.Address{},
"difficulty": nil, "difficulty": nil,
"totalDifficulty": nil, "totalDifficulty": nil,
"extraData": nil, "extraData": nil,
@ -861,6 +861,12 @@ func (e *PublicEthAPI) getGasLimit() (int64, error) {
// Save value to gasLimit cached value // Save value to gasLimit cached value
gasLimit := genesis.Genesis.ConsensusParams.Block.MaxGas gasLimit := genesis.Genesis.ConsensusParams.Block.MaxGas
if gasLimit == -1 {
// Sets gas limit to max uint32 to not error with javascript dev tooling
// This -1 value indicating no block gas limit is set to max uint64 with geth hexutils
// which errors certain javascript dev tooling which only supports up to 53 bits
gasLimit = int64(^uint32(0))
}
e.gasLimit = &gasLimit e.gasLimit = &gasLimit
return gasLimit, nil return gasLimit, nil
} }