Handle concurrent payments #287
Replies: 3 comments 4 replies
-
This problem also exists if the channel supports queuing payments and sends or accepts multiple payments without waiting for confirmation. I think if define some general pattern for how to merge payments we'll end up with logic that will work in both situations, where payment queuing is supported, or where queueing isn't supported but we use it to deal with concurrent payments. |
Beta Was this translation helpful? Give feedback.
-
I discussed this with @stanford-scs and @MonsieurNicolas and they raised the fact that a channel between two businesses will likely have messaging at a higher layer that are coordinating why payments are occurring and that layer could handle signaling of whose payment can be the next payment without needing to build that into the payment channel explicitly, or at least not into the state machine. |
Beta Was this translation helpful? Give feedback.
-
wrote up a suggestion here around how we could use lock-free synchronization techniques to potentially resolve these deadlocks, although I think @leighmcculloch's solution of merging is pretty good. https://docs.google.com/document/d/16ouWgE_qRlmWBA2-K7PT8ABlVRfnX95mpn1NG13i4UI/edit |
Beta Was this translation helpful? Give feedback.
-
Right now the SDK is enforcing that only one unconfirmed payment can be in play at a time. A channel can't propose two payments, as well as a channel can't confirm a different payment if they just proposed one. This was done so a channel is protected from unintentionally signing a payment they don't want.
eg. Channel A proposes p1, and is blocked from confirming a different payment until p1 is finished. Also, A is blocked from proposing p2 until p1 is complete.
However this introduces a deadlock, if two channels propose a payment at the same time. One solution could be a channel discards its unconfirmed payment for the new payment it just received. However if both channels do this then they are no longer in sync.
Adding this discussion to discuss possible solutions.
Beta Was this translation helpful? Give feedback.
All reactions