This repository was archived by the owner on Apr 4, 2024. It is now read-only.
Description System info: [Include Ethermint commit, operating system name, and other relevant details]
Ethermint v0.9.0
Web3j v4.8.9
Ubuntu: 18.04
Steps to reproduce:
[First Step]
Use the web3j to subscribe the block newHead event
WebSocketService ws = new WebSocketService("ws://127.0.0.1:8546",false);
ws.connect();
Web3j web3jWs = Web3j.build(ws);
Disposable subscription = web3jWs.blockFlowable(false).subscribe(block ->{
LOGGER.info(block.getBlock().getHash());
LOGGER.info(block.getBlock().getNumber().toString());
LOGGER.info(block.getBlock().getTimestamp().toString());
});
LOGGER.info("block simple filter example");
TimeUnit.MINUTES.sleep(10);
subscription.dispose();
[Second Step]
It returned the nullPointerError.
At the same time the contract subscription worked as expected.
Additional info: [Include gist of relevant config, logs, etc.]
I replaced the https://github.com/tharsis/ethermint/blob/cad7545f8a6ecf8c4da970f5ec20298ea8ff3ab0/rpc/ethereum/namespaces/eth/filters/api.go#L264-L268
to
header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee)
api.filtersMu.Lock()
fmt.Println(header.Hash().String())
if f, found := api.filters[headerSub.ID()]; found {
f.hashes = append(f.hashes, common.BytesToHash(data.Header.Hash().Bytes()))
}
It successed.