-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
PR HathorNetwork/hathor-core#1093 introduced changes in the Event Queue system from the hathor-core side, so the wallet-service must be updated. These are breaking changes.
When reorgs decrease the best height, transactions may be invalidated and removed from the mempool (in fact, completely deleted from the storage). Before, the Event Queue system did not handle this scenario. When this happens, there are two consequences that should be correctly handled by the wallet-service:
- Every dependency of a removed transaction will have its metadata updated, removing the transaction from itself. That is, parents will have that transaction removed from their
childrenmetadata, and input vertices will have that transaction removed from theirspent_outputs. - A new
VERTEX_REMOVEDevent will be emitted. Its only data is avertex_idkey with the hash of the removed transaction.
Note that the order above will always be respected. So, summing up events that could be received when a reorg occurs, in order:
- A
REORG_STARTEDevent is received (this existed before this update). - Multiple
VERTEX_METADATA_CHANGEDevents could be received containing metadata that was updated because of the reorg (this existed before).- It's possible that some of those updates reflect removal of transactions, as explained above (this is new).
- Multiple
VERTEX_REMOVEDcould be received (this is new). - A
REORG_FINISHEDevent is received (this existed before). - A
NEW_VERTEX_ACCEPTEDis received for the vertex that caused the reorg (this existed before).
A new INVALID_MEMPOOL_TRANSACTION simulation scenario is provided so this can be covered in integration tests.
Action items
- Handle new
VERTEX_REMOVEDevent. - Handle metadata updated with transaction removals (it's possible that this is naturally handled by existing code, but it should be checked).
- Implement integration test for the new
INVALID_MEMPOOL_TRANSACTIONscenario.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done