channeldb+routing: add new interface method TerminalInfo
This commit adds a new interface method `TerminalInfo` and changes its implementation to return an `*HTLCAttempt` so it includes the route for a successful payment. Method `GetFailureReason` is now removed as its returned value can be found in the above method.
This commit is contained in:
7 files changed
+59
-60
No files matched your search
@@ -219,10 +219,10 @@ func (m *MPPayment) Terminated() bool {
|
||||
// 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.
|
||||
func (m *MPPayment) TerminalInfo() (*HTLCSettleInfo, *FailureReason) {
|
||||
func (m *MPPayment) TerminalInfo() (*HTLCAttempt, *FailureReason) {
|
||||
for _, h := range m.HTLCs {
|
||||
if h.Settle != nil {
|
||||
return h.Settle, nil
|
||||
return &h, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,11 +464,6 @@ func (m *MPPayment) GetHTLCs() []HTLCAttempt {
|
||||
return m.HTLCs
|
||||
}
|
||||
|
||||
// GetFailureReason returns the failure reason.
|
||||
func (m *MPPayment) GetFailureReason() *FailureReason {
|
||||
return m.FailureReason
|
||||
}
|
||||
|
||||
// AllowMoreAttempts is used to decide whether we can safely attempt more HTLCs
|
||||
// for a given payment state. Return an error if the payment is in an
|
||||
// unexpected state.
|
||||
|
||||
Reference in new issue
Block a user