routing+htlcswitch: add new interface method HasAttemptResult

This commit is contained in:
yyforyongyu authored and yyforyongyu committed 2024-08-07 22:18:51 +08:00
1 parent bbf58ab444
commit b998ce11f1
3 files changed
+42

No files matched your search

+15
View File
@@ -431,6 +431,21 @@ func (s *Switch) ProcessContractResolution(msg contractcourt.ResolutionMsg) erro
}
}
// HasAttemptResult reads the network result store to fetch the specified
// attempt. Returns true if the attempt result exists.
func (s *Switch) HasAttemptResult(attemptID uint64) (bool, error) {
_, err := s.networkResults.getResult(attemptID)
if err == nil {
return true, nil
}
if !errors.Is(err, ErrPaymentIDNotFound) {
return false, err
}
return false, nil
}
// GetAttemptResult returns the result of the HTLC attempt with the given
// attemptID. The paymentHash should be set to the payment's overall hash, or
// in case of AMP payments the payment's unique identifier.