[epic]: Payment and Router separation #8834
Labels
advanced
Issues suitable for very experienced developers
architecture
Related to system design
bug fix
enhancement
Improvements to existing features / behaviour
epic
Issues created to track large feature development
payments
Related to invoices/payments
routing
paymentLifecyle
is the main struct to handle sending payments and can be moved out ofrouting
package, which has the benefits,Current State
As of today, multiple components are involved when sending payments, as shown below,
The components are,
ControlTower
: handles interaction with DB(CRUD)MissionControl
: records success probablityPaymentSession
(paymentSession
): requests routes and updates edges/policies from private channelsPaymentAttemptDispatcher
: interacts withSwitch
to send HTLC and get HTLC attempt results, which is an interface violation.ChannelRouter.applyChannelUpdate
: updates edges using failed HTLCsProposed Design
The proposed architecture,
Some highlights,
payment
) and interacts with the third layerChannelRouter
.paymentLifecycle
isChannelRouter.SendAttempt
, which takes an attempt request specifying params like routes, onions, amt, etc.htlcswitch
(layer-two), and "HTLC attempt" or "Attempt" (or other better names?) is a concept used inrouting
(layer-three).By adding
SendAttempt
,htlcswitch
is no longer exposed topaymentLifecycle
. Instead, an HTLC attempt always goes through the graph managed byChannelRouter
first, and it's up toChannelRouter
to decide whether a route can be used or not, which solves the race condition when two HTLC attempts are using the same route without being aware of each other, as manifested in itest flakes.Plan
paymentLifecycle
out ofrouting
.SendAttempt
, implement it inrouting
and use it inpaymentLifecycle
.The text was updated successfully, but these errors were encountered: