-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist swap phase in db #1079
Labels
P1
top priority
Comments
The new phases look good. I'm thinking we might want to separate the phases so that they are specific to the role I believe this would make the debugging experience better/more readable. |
sangaman
added a commit
that referenced
this issue
Jul 5, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Jul 5, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Jul 5, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Jul 5, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In all other cases, we simply attempt to close any open invoices and mark the swap deal as having errored. Raiden currently does not expose an API call to query for the preimage of a completed payment. The recovery attempts happen once on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Jul 5, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In all other cases, we simply attempt to close any open invoices and mark the swap deal as having errored. Raiden currently does not expose an API call to query for the preimage of a completed payment. The recovery attempts happen once on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Jul 7, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In all other cases, we simply attempt to close any open invoices and mark the swap deal as having errored. Raiden currently does not expose an API call to query for the preimage of a completed payment. The recovery attempts happen once on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Jul 7, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In all other cases, we simply attempt to close any open invoices and mark the swap deal as having errored. Raiden currently does not expose an API call to query for the preimage of a completed payment. The recovery attempts happen once on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Jul 8, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Aug 5, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Aug 5, 2019
This commit persists the state of swap deals to the database upon each phase change once a deal has been accepted to. This is done to be able to prevent loss of funds and recover gracefully from any active swaps should `xud` crash unexpectedly. This is the first step towards closing #1079.
sangaman
added a commit
that referenced
this issue
Aug 5, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In case the payment is knkown to have failed, we simply attempt to close any open invoices and mark the swap deal as having errored. If an outgoing payment is still in flight and we do not have the preimage for it, we add it to a set of "pending" swaps and check on it on a scheduled interval until we can determine whether it has failed or succeeded. A new `SwapRecovery` class is introduced to contain the logic for recovering interrupted swap deals and for tracking swaps that are still pending. Raiden currently does not expose an API call to push a preimage to claim an incoming payment or to reject an incoming payment, instead we print a warning to the log for now. The recovery attempts happen on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Aug 26, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In case the payment is known to have failed, we simply attempt to close any open invoices and mark the swap deal as having errored. If an outgoing payment is still in flight and we do not have the preimage for it, we add it to a set of "pending" swaps and check on it on a scheduled interval until we can determine whether it has failed or succeeded. A new `SwapRecovery` class is introduced to contain the logic for recovering interrupted swap deals and for tracking swaps that are still pending. Raiden currently does not expose an API call to push a preimage to claim an incoming payment or to reject an incoming payment, instead we print a warning to the log for now. The recovery attempts happen on `xud` startup by looking for any swap deals in the database that have an `Active` state. Closes #1079.
sangaman
added a commit
that referenced
this issue
Sep 11, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In case the payment is known to have failed, we simply attempt to close any open invoices and mark the swap deal as having errored. If an outgoing payment is still in flight and we do not have the preimage for it, we add it to a set of "pending" swaps and check on it on a scheduled interval until we can determine whether it has failed or succeeded. A new `SwapRecovery` class is introduced to contain the logic for recovering interrupted swap deals and for tracking swaps that are still pending. Any pending swaps are listed in the `GetInfo` response. Raiden currently does not expose an API call to push a preimage to claim an incoming payment or to reject an incoming payment, instead we print a warning to the log for now. The recovery attempts happen on `xud` startup by looking for any swap deals in the database that have an `Active` state. This commit includes a suite of test cases for the newly added functionality. Closes #1079.
sangaman
added a commit
that referenced
this issue
Sep 11, 2019
This commit attempts to recover swap deals that were interrupted due to a system or `xud` crash. In the case where we are the maker and have attempted to send payment for the second leg of the swap, we attempt to query the swap client for the preimage of that payment in case it went through. We can then use that preimage to try to claim the payment from the first leg of the swap. In case the payment is known to have failed, we simply attempt to close any open invoices and mark the swap deal as having errored. If an outgoing payment is still in flight and we do not have the preimage for it, we add it to a set of "pending" swaps and check on it on a scheduled interval until we can determine whether it has failed or succeeded. A new `SwapRecovery` class is introduced to contain the logic for recovering interrupted swap deals and for tracking swaps that are still pending. Any pending swaps are listed in the `GetInfo` response. Raiden currently does not expose an API call to push a preimage to claim an incoming payment or to reject an incoming payment, instead we print a warning to the log for now. The recovery attempts happen on `xud` startup by looking for any swap deals in the database that have an `Active` state. This commit includes a suite of test cases for the newly added functionality. Closes #1079.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basics: all measures to handle failures/attacks in a swap flow gracefully (#942 ) require the node to know which phase the swap is in. This issue is about persisting the
SwapPhase
&SwapState
(reason to be in that state as per types.ts) in db after each step in the protocol, read it after restarts/crashes and display swaps in critical phases ingetinfo
.Status Quo
Currently these
SwapPhase
s are already present, but only success/failure is persisted in theswapdeals
table inxud.db
:TODO
5
with some details (tbd) ingetinfo
to bring these to the users's attention. Then user can use ID to search the log for details.The text was updated successfully, but these errors were encountered: