Ganache-cli: Handling of pending blocks and pending transactions is broken

Created on 24 Jan 2018  路  10Comments  路  Source: trufflesuite/ganache-cli

Expected Behavior

Calling eth_getTransactionByHash for a transaction hash that is pending (not included in a block) on the ganache node should return the given transaction.

This is the behaviour that a full node (geth, parity) follows

Current Behavior

The call to eth_getTransactionByHash for a pending transaction returns null

Steps to Reproduce (for bugs)

  1. Run ganache with a custom block time: ganache-cli -b 30
  2. Send transaction: tx = web3.eth.sendTransaction({'from': '0x', 'to': '0x', 'value': 1})
  3. Retrieve this pending transaction by ID web3.eth.getTransaction(tx)
  4. Returns null

Context

@ https://github.com/ethereum/web3.py/issues/492 we are looking at providing an API for resending transactions. To do this we rely on being able to read pending transaction details. I was using ganache-cli to test this behaviour and noticed this issue. It doesn't really block our development though as web3py uses another test node: https://github.com/pipermerriam/eth-testrpc

Your Environment

  • Version used: v6.0.3 (ganache-core: 2.0.2)
  • NodeJS Version: 9.x
  • Operating System and version (include distro if Linux): Mac OS High Sierra
bug priority-high

Most helpful comment

@IvanTheGreatDev The PR for this issue is currently in code review. It'll be fixed very soon!

All 10 comments

Hi @monokh this is actually a known issue, though I keep forgetting to actually raise an issue for it - thanks for doing that!

We actually don't handle pending blocks very well, either. I've retitled this ticket and I'll do my best to address it, though I think it's a lower priority at the moment as compared to some other issues. As a result, a PR from the community would be excellent!

Actually, fixing this might make for a good bounty case! I'll discuss with the team.

@benjamincburns is it possible if I fix this issue? I'm new, and this has a "good first time contribution tag". That okay?

Hi, has there been any progress made on this, from the community or otherwise?

I'd advise against fixing this at the moment, as I'm presently doing a fairly major refactoring of the ganache-core internals. I expect this issue will be mostly fixed by this refactoring, however, as we'll have an actual "pending block" containing pending transactions at that time.

Any progress on this?

Is there any news on this one?

Any updates on this?

@IvanTheGreatDev The PR for this issue is currently in code review. It'll be fixed very soon!

@IvanTheGreatDev The code was merged into develop and will be released soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leopoldjoy picture leopoldjoy  路  3Comments

DavidKuennen picture DavidKuennen  路  4Comments

gskerry picture gskerry  路  3Comments

varasev picture varasev  路  3Comments

axic picture axic  路  5Comments