rpc: fix eth_getBlockByNumber
(#78)
This commit is contained in:
parent
1ff3c46663
commit
fcb7c114d0
@ -137,13 +137,14 @@ func (e *EVMBackend) EthBlockFromTendermint(
|
||||
|
||||
txReceiptsResp, err := queryClient.TxReceiptsByBlockHeight(types.ContextWithHeight(block.Height), req)
|
||||
if err != nil {
|
||||
e.logger.Debugf("TxReceiptsByBlockHeight fail: %s", err.Error())
|
||||
return nil, err
|
||||
e.logger.WithError(err).Debugln("TxReceiptsByBlockHeight failed")
|
||||
}
|
||||
|
||||
gasUsed := big.NewInt(0)
|
||||
|
||||
ethRPCTxs := make([]interface{}, 0, len(txReceiptsResp.Receipts))
|
||||
ethRPCTxs := []interface{}{}
|
||||
|
||||
if txReceiptsResp != nil {
|
||||
|
||||
for _, receipt := range txReceiptsResp.Receipts {
|
||||
hash := common.HexToHash(receipt.Hash)
|
||||
@ -170,11 +171,13 @@ func (e *EVMBackend) EthBlockFromTendermint(
|
||||
ethRPCTxs = append(ethRPCTxs, hash)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blockBloomResp, err := queryClient.BlockBloom(types.ContextWithHeight(block.Height), &evmtypes.QueryBlockBloomRequest{})
|
||||
if err != nil {
|
||||
e.logger.WithError(err).Debugln("failed to query BlockBloom at height", block.Height)
|
||||
blockBloomResp.Bloom = ethtypes.Bloom{}.Bytes()
|
||||
e.logger.WithError(err).Debugln("failed to query BlockBloom", "height", block.Height)
|
||||
|
||||
blockBloomResp = &evmtypes.QueryBlockBloomResponse{Bloom: ethtypes.Bloom{}.Bytes()}
|
||||
}
|
||||
|
||||
bloom := ethtypes.BytesToBloom(blockBloomResp.Bloom)
|
||||
|
@ -199,7 +199,7 @@ func FormatBlock(
|
||||
"receiptsRoot": ethtypes.EmptyRootHash,
|
||||
|
||||
"uncles": []common.Hash{},
|
||||
"transactions": transactions.([]common.Hash),
|
||||
"transactions": transactions,
|
||||
"totalDifficulty": (*hexutil.Big)(big.NewInt(0)),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user