github.com/decred/dcrlnd@v0.7.6/channeldb/migration_01_to_11/payment_control.go (about)

     1  package migration_01_to_11
     2  
     3  import "github.com/decred/dcrlnd/kvdb"
     4  
     5  // fetchPaymentStatus fetches the payment status of the payment. If the payment
     6  // isn't found, it will default to "StatusUnknown".
     7  func fetchPaymentStatus(bucket kvdb.RBucket) PaymentStatus {
     8  	if bucket.Get(paymentSettleInfoKey) != nil {
     9  		return StatusSucceeded
    10  	}
    11  
    12  	if bucket.Get(paymentFailInfoKey) != nil {
    13  		return StatusFailed
    14  	}
    15  
    16  	if bucket.Get(paymentCreationInfoKey) != nil {
    17  		return StatusInFlight
    18  	}
    19  
    20  	return StatusUnknown
    21  }