bee icon indicating copy to clipboard operation
bee copied to clipboard

fix: cancel tx if missing from blockchain after some timeout

Open acha-bill opened this issue 5 months ago • 3 comments

Checklist

  • [x] I have read the coding guide.
  • [ ] My change requires a documentation update, and I have done it.
  • [x] I have added tests to cover my changes.
  • [x] I have filled out the description and linked the related issues.

Description

Cancel a tx if it's missing from the blockchain after a certain timeout—currently, 5 block times.

closes #5133

acha-bill avatar Jul 16 '25 05:07 acha-bill

Is there a way we can test this?

martinconic avatar Jul 18 '25 08:07 martinconic

Is there a way we can test this?

Maybe we can test it mannualy with insufficient gas, invalid signature, low nonce, or insufficient funds.

gacevicljubisa avatar Jul 30 '25 14:07 gacevicljubisa

In general, I'm not sure about this mechanism. If there has been a transaction that has been signed, and broadcast to some RPC, while that RPC may have some failures of some sort, the bee node has no way to intrinsically verify this.

As such, transactions should never be deemed "cancelled" unless in the circumstance that another transaction has been verified on chain that corresponds to the cancelled transaction's nonce.

For example, if the transaction monitor sent to the RPC a transaction, and after some time, when checking the account's nonce from the RPC it hadn't incremented (ie. the transaction hadn't been confirmed), then it seems that the "failed transaction" could instead be determined to be "stale" and the transaction monitor could simply broadcast another transaction using the same nonce (and if this subsequent transaction is verified, then the stale transaction would change state to 'dropped' / 'cancelled').

mfw78 avatar Sep 19 '25 08:09 mfw78