channeldb+routing: htlcs are pruned on settle
This commit is contained in:
1 parent
8291e8a170
commit
2dd11ed249
6 files changed
+164
-5
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user