channeldb+routing: htlcs are pruned on settle

This commit is contained in:
Tommy Volk committed 2022-07-03 21:04:34 +00:00
1 parent 8291e8a170
commit 2dd11ed249
6 files changed
+164 -5

No files matched your search

+14 -2
View File
@@ -186,9 +186,21 @@ lifecycle:
// Find the first successful shard and return
// the preimage and route.
for _, a := range payment.HTLCs {
if a.Settle != nil {
return a.Settle.Preimage, &a.Route, nil
if a.Settle == nil {
continue
}
err := p.router.cfg.Control.
DeleteFailedAttempts(
p.identifier)
if err != nil {
log.Errorf("Error deleting failed "+
"payment attempts for "+
"payment %v: %v", p.identifier,
err)
}
return a.Settle.Preimage, &a.Route, nil
}
// Payment failed.