web3j icon indicating copy to clipboard operation
web3j copied to clipboard

Transaction MessageDecode exception

Open lukerQuant opened this issue 3 years ago • 1 comments

Transaction MessageDecode exception

For any unconfirmed transaction in the pending pool, we have been getting a messageDecode exception.

Steps To Reproduce

We are using web3j 4.8.4 and getting a transaction object fo transactions recently been added to the pending pool (example data found here: https://etherscan.io/txsPending?&so)

Expected behavior

Web3js returns a transaction object (with a few params set to null) in this case (https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#gettransaction)

Actual behavior

We get a messageDecode exception for Block Number & Block Hash

Environment

  • Web3j version: 4.8.4
  • geth v1.10.1 node (i.e. latest)
  • Java web3j version

Additional context

Using ethGetTransactionByHash

"message": "JSON mapping problem: io.overledger.standards.transaction.TransactionResponse["transaction"]->io.overledger.standards.transaction.Transaction["nativeData"]->org.web3j.protocol.core.methods.response.Transaction["blockNumber"]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Value must be in format 0x[1-9]+[0-9]* or 0x0 (through reference chain: io.overledger.standards.transaction.TransactionResponse["transaction"]->io.overledger.standards.transaction.Transaction["nativeData"]->org.web3j.protocol.core.methods.response.Transaction["blockNumber"])",

lukerQuant avatar Mar 25 '21 14:03 lukerQuant

H! I've tried that on web3j core version 4.8.1 and 4.9.6 . I was calling txPoolContent() and once then I called getBlockNumber() on pending transaction which resulted in an exception: org.web3j.exceptions.MessageDecodingException: Value must be in format 0x[1-9]+[0-9]* or 0x0 at org.web3j.utils.Numeric.decodeQuantity(Numeric.java:48) at org.web3j.protocol.core.methods.response.Transaction.getBlockNumber(Transaction.java:175)

IMO the assumption is that blockNumber cannot be null and that is why it fails. There need to be a code change in Transaction.getBlockNumber() to either return Optional or null otherwise it will fail.

darekurlik avatar Feb 17 '23 12:02 darekurlik