Skip to content

[Bug]: Emily's GET /withdrawal/:id does not handle reorgs correctly #1807

@djordon

Description

@djordon

Bug - Emily's GET /withdrawal/:id does not handle reorgs correctly

1. Description

Whenever there is a reorg that affects a withdrawal request, the request ID is available for reuse. This means that there is likely to be another withdrawal request that shares the same request ID but has another block hash. When this happens, there will be two entries in the database that share the same request ID. The issue is that the handler of GET /withdrawal/:id API calls on Emily will return an error if there are more than one withdrawal request for the given ID. Instead we should return the data corresponding to the withdrawal request that is on the canonical stacks blockchain.

2. Technical Details

We do not want to return an error if there are more than one withdrawal request for a given request ID, but choose the canonical withdrawal request. The canonical withdrawal request should be the one where we have a record of the stacks block confirming the withdrawal request in our database. This is because we delete stacks blocks during a reorg.

2.1 Acceptance Criteria

  • GET /withdrawal/:id returns the correct withdrawal request if there was a reorg and a new withdrawal request was generated.

3. Related Issues and Pull Requests (optional)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingemilyAPI that communicates with Signers to trigger sBTC operations.

Type

Projects

Status

In Review

Relationships

None yet

Development

No branches or pull requests

Issue actions