forked from cerc-io/laconicd-deprecated
rpc: fix Bloom filter response (#321)
* fix bloomfilter in rpc response * add comments
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user