diff --git a/routing/missioncontrol.go b/routing/missioncontrol.go index a1793ad0..78339b75 100644 --- a/routing/missioncontrol.go +++ b/routing/missioncontrol.go @@ -238,9 +238,6 @@ func NewMissionControl(db kvdb.Backend, self route.Vertex, func (m *MissionControl) init() error { log.Debugf("Mission control state reconstruction started") - m.Lock() - defer m.Unlock() - start := time.Now() results, err := m.store.fetchAll() @@ -392,9 +389,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{ @@ -415,9 +409,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{ @@ -442,6 +433,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)