rpc: fix Bloom filter response (#321)

* fix bloomfilter in rpc response

* add comments
This commit is contained in:
Thomas Nguy
2021-07-20 15:16:02 +00:00
committed by GitHub
parent bb6622b7fb
commit 0276f3465d
9 changed files with 165 additions and 92 deletions
+3 -3
View File
@@ -204,7 +204,7 @@ func (e *EVMBackend) EthBlockFromTendermint(
}
}
blockBloomResp, err := e.queryClient.BlockBloom(types.ContextWithHeight(block.Height), &evmtypes.QueryBlockBloomRequest{})
blockBloomResp, err := e.queryClient.BlockBloom(types.ContextWithHeight(block.Height), &evmtypes.QueryBlockBloomRequest{Height: block.Height})
if err != nil {
e.logger.Debug("failed to query BlockBloom", "height", block.Height, "error", err.Error())
@@ -266,7 +266,7 @@ func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Heade
return nil, err
}
req := &evmtypes.QueryBlockBloomRequest{}
req := &evmtypes.QueryBlockBloomRequest{Height: resBlock.Block.Height}
blockBloomResp, err := e.queryClient.BlockBloom(types.ContextWithHeight(resBlock.Block.Height), req)
if err != nil {
@@ -287,7 +287,7 @@ func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, erro
return nil, err
}
req := &evmtypes.QueryBlockBloomRequest{}
req := &evmtypes.QueryBlockBloomRequest{Height: resBlock.Block.Height}
blockBloomResp, err := e.queryClient.BlockBloom(types.ContextWithHeight(resBlock.Block.Height), req)
if err != nil {
+1
View File
@@ -30,6 +30,7 @@ func NewBlockNumber(n *big.Int) BlockNumber {
// ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is
// 0, it will return an empty context and the gRPC query will use the latest block height for querying.
// Note that all metadata are processed and removed by tendermint layer, so it wont be accessible at gRPC server level.
func ContextWithHeight(height int64) context.Context {
if height == 0 {
return context.Background()