payment_control: remove unused Attempts field

This commit is contained in:
Johan T. Halseth 2020-09-24 09:48:27 +02:00
parent 46225e2921
commit d1a118388d
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
2 changed files with 3 additions and 40 deletions

@ -673,16 +673,11 @@ func ensureInFlight(payment *MPPayment) error {
}
}
// InFlightPayment is a wrapper around a payment that has status InFlight.
// InFlightPayment is a wrapper around the info for a payment that has status
// InFlight.
type InFlightPayment struct {
// Info is the PaymentCreationInfo of the in-flight payment.
Info *PaymentCreationInfo
// Attempts is the set of payment attempts that was made to this
// payment hash.
//
// NOTE: Might be empty.
Attempts []HTLCAttemptInfo
}
// FetchInFlightPayments returns all payments with status InFlight.
@ -718,33 +713,6 @@ func (p *PaymentControl) FetchInFlightPayments() ([]*InFlightPayment, error) {
return err
}
htlcsBucket := bucket.NestedReadBucket(
paymentHtlcsBucket,
)
if htlcsBucket == nil {
return nil
}
// Fetch all HTLCs attempted for this payment.
htlcs, err := fetchHtlcAttempts(htlcsBucket)
if err != nil {
return err
}
// We only care about the static info for the HTLCs
// still in flight, so convert the result to a slice of
// HTLCAttemptInfos.
for _, h := range htlcs {
// Skip HTLCs not in flight.
if h.Settle != nil || h.Failure != nil {
continue
}
inFlight.Attempts = append(
inFlight.Attempts, h.HTLCAttemptInfo,
)
}
inFlights = append(inFlights, inFlight)
return nil
})

@ -446,13 +446,8 @@ func (m *mockControlTower) FetchInFlightPayments() (
continue
}
var attempts []channeldb.HTLCAttemptInfo
for _, a := range p.attempts {
attempts = append(attempts, a.HTLCAttemptInfo)
}
ifl := channeldb.InFlightPayment{
Info: &p.info,
Attempts: attempts,
}
fl = append(fl, &ifl)