routing: always update payment in the same goroutine

This commit refactors `collectResultAsync` such that this method is now
only responsible for collecting results from the switch. The method
`decideNextStep` is expanded to process these results in the same
goroutine where we fetch the payment from db, to make sure the lifecycle
loop always have a consistent view of a given payment.
This commit is contained in:
yyforyongyu committed 2025-02-10 11:29:29 +08:00
1 parent e1279aab20
commit 1acf4d7d4d
3 files changed
+405 -152

No files matched your search

+1 -1
View File
@@ -1186,7 +1186,7 @@ func (r *ChannelRouter) sendToRoute(htlcHash lntypes.Hash, rt *route.Route,
// The attempt was successfully sent, wait for the result to be
// available.
result, err = p.collectResult(attempt)
result, err = p.collectAndHandleResult(attempt)
if err != nil {
return nil, err
}