channeldb+routing: apply method Terminated to decide a payment's terminal state
This commit applies the new method `Terminated`. A side effect from using this method is, we can now save one query `fetchPayment` inside `FetchInFlightPayments`.
This commit is contained in:
1 parent
fac6044501
commit
c175386c4d
4 files changed
+26
-19
No files matched your search
@@ -177,6 +177,13 @@ type MPPayment struct {
|
||||
Status PaymentStatus
|
||||
}
|
||||
|
||||
// Terminated returns a bool to specify whether the payment is in a terminal
|
||||
// state.
|
||||
func (m *MPPayment) Terminated() bool {
|
||||
// If the payment is in terminal state, it cannot be updated.
|
||||
return m.Status.updatable() != nil
|
||||
}
|
||||
|
||||
// TerminalInfo returns any HTLC settle info recorded. If no settle info is
|
||||
// recorded, any payment level failure will be returned. If neither a settle
|
||||
// nor a failure is recorded, both return values will be nil.
|
||||
|
||||
Reference in new issue
Block a user