mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 06:35:07 +01:00
routing: fix mission control deadlock
This commit fixes the following potential deadlock situation: * Pathfinding holds a database lock and tries to obtain a mission control lock via GetProbability * ReportPaymentSuccess/ReportPaymentFail holds a mission control lock and tries to obtain a database lock to store the payment result.
This commit is contained in:
parent
419ad86209
commit
89751f869f
1 changed files with 3 additions and 6 deletions
|
@ -371,9 +371,6 @@ func (m *MissionControl) ReportPaymentFail(paymentID uint64, rt *route.Route,
|
|||
failureSourceIdx *int, failure lnwire.FailureMessage) (
|
||||
*channeldb.FailureReason, error) {
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
timestamp := m.now()
|
||||
|
||||
result := &paymentResult{
|
||||
|
@ -394,9 +391,6 @@ func (m *MissionControl) ReportPaymentFail(paymentID uint64, rt *route.Route,
|
|||
func (m *MissionControl) ReportPaymentSuccess(paymentID uint64,
|
||||
rt *route.Route) error {
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
timestamp := m.now()
|
||||
|
||||
result := &paymentResult{
|
||||
|
@ -421,6 +415,9 @@ func (m *MissionControl) processPaymentResult(result *paymentResult) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
// Apply result to update mission control state.
|
||||
reason := m.applyPaymentResult(result)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue