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
@@ -309,6 +309,32 @@ func (m *mockControlTowerOld) InitPayment(phash lntypes.Hash,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockControlTowerOld) DeleteFailedAttempts(phash lntypes.Hash) error {
|
||||
p, ok := m.payments[phash]
|
||||
if !ok {
|
||||
return channeldb.ErrPaymentNotInitiated
|
||||
}
|
||||
|
||||
var inFlight bool
|
||||
for _, a := range p.attempts {
|
||||
if a.Settle != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if a.Failure != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
inFlight = true
|
||||
}
|
||||
|
||||
if inFlight {
|
||||
return channeldb.ErrPaymentInFlight
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockControlTowerOld) RegisterAttempt(phash lntypes.Hash,
|
||||
a *channeldb.HTLCAttemptInfo) error {
|
||||
|
||||
@@ -665,6 +691,11 @@ func (m *mockControlTower) InitPayment(phash lntypes.Hash,
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockControlTower) DeleteFailedAttempts(phash lntypes.Hash) error {
|
||||
args := m.Called(phash)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockControlTower) RegisterAttempt(phash lntypes.Hash,
|
||||
a *channeldb.HTLCAttemptInfo) error {
|
||||
|
||||
|
||||
Reference in new issue
Block a user