hydra
hydra copied to clipboard
Clear pending transactions API command
Why
Processing transactions in a Hydra head requires each node to agree on transactions. The protocol will validate transactions (on NewTx command) against it's local view of the ledger state, using the passed --ledger-protocol-parameters. As transactions can be valid or invalid based on configuration (or to some extent exact build versions of hydra-node), it is possible that one node accepts a transaction, while the peer nodes do not.
Currently, this means that the node which accepted the transaction now has a different local state than the other nodes and might try to spend outputs that other nodes don't see available. For example, when using hydraw, the node would be using outputs introduced by the previous pixel paint transaction, but other nodes will deem any new transaction invalid with a BadInputs error.
Within this feature, we want to improve the UX of hydra-node in presence of such misalignments.
What
- Add an API query to the
hydra-nodewhich includes pending transactions (fromlocalTxsin the head state) - Add a API command to the
hydra-nodewhich allows to clear pending transactions- This basically means to reset the
localUTxOto the lastconfirmedsnapshotutxoand emptylocalTxs
- This basically means to reset the
- Update documentation to explain this situation and when to use this command
TBD
-
Make the
hydra-nodenot persist the local view instead and achieve the same by restarting nodes? -
This idea above does require a coordinated action by all operators. Use a checkpoint like transaction on chain to do this instead?
- i.e. post the last confirmed snapshot state, which makes all nodes reset their local state upon observing it
-
Also: Could fetch latest confirmed snapshots from other peers on startup and if they have a valid multi-signature adopt them.