Motivation
Because of race conditions, it's possible for a node to send unnecessary transactions. Example:
- Node B reveals the secret off-chain to A, but A takes a bit of time to send the unlock and B reveal it on-chain.
- Node A processes the message before the transaction is mined, since the lock expiration is constant, A will try to register the secret on-chain.
- The transaction from B is mined, and A may want to overwrite it's transaction.
Specification
This is a tricky problem, because cancelling a transaction in-flight can fail and requires rewriting all previous transactions. It may also be more expensive because clients reject the cheaper transactions, so the gas_price and gas_limit must be taken into account. To properly implement this needed:
- The JSON RPC client will have to maintain an explicit queue of transactions (currently this is implicitly maintained by the greenlets).
- The core logic will need new events which try to remove unnecessary transactions, the sent transaction is probably not in queue anymore because it was either superseded or cancelled.
- The event handler will request the JSON RPC to remove the transaction. If the transaction was not sent yet it's easy, just remove from the queue, otherwise then a new unsent transaction is required to overwrite it.
Backwards Compatibility
- This doesn't change the off-chain protocol, so there is no backwards/forwards compatibility there.
- This will need a new event, but since events only need to be forward compatible a transaction is not necessary.
Motivation
Because of race conditions, it's possible for a node to send unnecessary transactions. Example:
Specification
This is a tricky problem, because cancelling a transaction in-flight can fail and requires rewriting all previous transactions. It may also be more expensive because clients reject the cheaper transactions, so the gas_price and gas_limit must be taken into account. To properly implement this needed:
Backwards Compatibility