2019-10-24 13:04:26 +03:00
|
|
|
package migration_01_to_11
|
|
|
|
|
2019-12-13 05:22:19 +03:00
|
|
|
import "github.com/lightningnetwork/lnd/channeldb/kvdb"
|
2019-10-24 13:04:26 +03:00
|
|
|
|
|
|
|
// fetchPaymentStatus fetches the payment status of the payment. If the payment
|
|
|
|
// isn't found, it will default to "StatusUnknown".
|
2020-05-07 01:48:00 +03:00
|
|
|
func fetchPaymentStatus(bucket kvdb.RBucket) PaymentStatus {
|
2019-10-24 13:04:26 +03:00
|
|
|
if bucket.Get(paymentSettleInfoKey) != nil {
|
|
|
|
return StatusSucceeded
|
|
|
|
}
|
|
|
|
|
|
|
|
if bucket.Get(paymentFailInfoKey) != nil {
|
|
|
|
return StatusFailed
|
|
|
|
}
|
|
|
|
|
|
|
|
if bucket.Get(paymentCreationInfoKey) != nil {
|
|
|
|
return StatusInFlight
|
|
|
|
}
|
|
|
|
|
|
|
|
return StatusUnknown
|
|
|
|
}
|