elixir-omg
elixir-omg copied to clipboard
Utxos in a successful /transaction.submit but not yet mined should be excluded from account's available utxos
Copying over @pnowosie's explanation:
tx
submitted to ch-ch- ch-ch publishes new block's
hash
in transaction on Ethereum- Watcher discovers the above Ethereum transaction
- Watcher asks ch-ch of block for a given
hash
- Ch-ch responds with block which contains
tx
- Watcher processes block and includes
tx
in DB (here Watcher is Info-Api Watcher)Latency:
- Time needed for a block to be formed (~1 plasma block per Ethereum block)
- Block publication transaction needs to be mined on Ethereum (depends on gas price and Ehereum blocks freq)
- Then on Watcher side Ehereum event listener check interval
- Network latency in Watcher -> Ch-ch
- Block processing time (checking especially all signatures in large blocks takes a little)
- DB insert
Because of this latency, the same utxo might be picked up by /transaction.create again before it is marked as spent by the first submission.
Need a way to keep track of utxos that are being processed.
This is a bit tricky though...because only the specific watcher that receives the /transaction.submit
request would know such account related info. I think ideally it should be the responsibility of a layer on top of the watcher (eg. e-wallet) to handle account-related states, especially there are pending states.