multi: rename Payment.PaymentPreimage to Payment.Preimage
Preliminary step to exposing PaymentPreimage() as a method that can be shared between legacy payments and mutli-path payments.
This commit is contained in:
parent
b03d8edcd9
commit
fbd599a2cb
@ -239,11 +239,11 @@ type Payment struct {
|
||||
// NOTE: Can be nil if no attempt is yet made.
|
||||
Attempt *PaymentAttemptInfo
|
||||
|
||||
// PaymentPreimage is the preimage of a successful payment. This serves
|
||||
// as a proof of payment. It will only be non-nil for settled payments.
|
||||
// Preimage is the preimage of a successful payment. This serves as a
|
||||
// proof of payment. It will only be non-nil for settled payments.
|
||||
//
|
||||
// NOTE: Can be nil if payment is not settled.
|
||||
PaymentPreimage *lntypes.Preimage
|
||||
Preimage *lntypes.Preimage
|
||||
|
||||
// Failure is a failure reason code indicating the reason the payment
|
||||
// failed. It is only non-nil for failed payments.
|
||||
@ -363,7 +363,7 @@ func fetchPayment(bucket *bbolt.Bucket) (*Payment, error) {
|
||||
if b != nil {
|
||||
var preimg lntypes.Preimage
|
||||
copy(preimg[:], b[:])
|
||||
p.PaymentPreimage = &preimg
|
||||
p.Preimage = &preimg
|
||||
}
|
||||
|
||||
// Get failure reason if available.
|
||||
|
@ -214,7 +214,7 @@ func (p *controlTower) SubscribePayment(paymentHash lntypes.Hash) (
|
||||
// immediately.
|
||||
case channeldb.StatusSucceeded:
|
||||
event = *createSuccessResult(
|
||||
&payment.Attempt.Route, *payment.PaymentPreimage,
|
||||
&payment.Attempt.Route, *payment.Preimage,
|
||||
)
|
||||
|
||||
// Payment already failed. It is not necessary to register as a
|
||||
|
12
rpcserver.go
12
rpcserver.go
@ -4348,9 +4348,8 @@ func (r *rpcServer) ListPayments(ctx context.Context,
|
||||
continue
|
||||
}
|
||||
|
||||
// If a payment attempt has been made we can fetch the route.
|
||||
// Otherwise we'll just populate the RPC response with an empty
|
||||
// one.
|
||||
// Fetch the payment's route, which will be empty if an attempt
|
||||
// has not been made.
|
||||
var route route.Route
|
||||
if payment.Attempt != nil {
|
||||
route = payment.Attempt.Route
|
||||
@ -4360,10 +4359,11 @@ func (r *rpcServer) ListPayments(ctx context.Context,
|
||||
path[i] = hex.EncodeToString(hop.PubKeyBytes[:])
|
||||
}
|
||||
|
||||
// If this payment is settled, the preimage will be available.
|
||||
// Fetch the preimage if the payment was successful, otherwise a
|
||||
// zero-value preimage will be used.
|
||||
var preimage lntypes.Preimage
|
||||
if payment.PaymentPreimage != nil {
|
||||
preimage = *payment.PaymentPreimage
|
||||
if payment.Preimage != nil {
|
||||
preimage = *payment.Preimage
|
||||
}
|
||||
|
||||
msatValue := int64(payment.Info.Value)
|
||||
|
Loading…
Reference in New Issue
Block a user