mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-27 18:56:30 +02:00
channeldb: fix variable name used in RegisterAttempt
Renamed `p` to `payment` to since it's used by the method's pointer receiver.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
105c275b91
commit
c71601124a
@@ -305,7 +305,7 @@ func (p *PaymentControl) RegisterAttempt(paymentHash lntypes.Hash,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := fetchPayment(bucket)
|
payment, err = fetchPayment(bucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -313,20 +313,20 @@ func (p *PaymentControl) RegisterAttempt(paymentHash lntypes.Hash,
|
|||||||
// We cannot register a new attempt if the payment already has
|
// We cannot register a new attempt if the payment already has
|
||||||
// reached a terminal condition. We check this before
|
// reached a terminal condition. We check this before
|
||||||
// ensureInFlight because it is a more general check.
|
// ensureInFlight because it is a more general check.
|
||||||
settle, fail := p.TerminalInfo()
|
settle, fail := payment.TerminalInfo()
|
||||||
if settle != nil || fail != nil {
|
if settle != nil || fail != nil {
|
||||||
return ErrPaymentTerminal
|
return ErrPaymentTerminal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the payment is in-flight.
|
// Ensure the payment is in-flight.
|
||||||
if err := ensureInFlight(p); err != nil {
|
if err := ensureInFlight(payment); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure any existing shards match the new one with regards
|
// Make sure any existing shards match the new one with regards
|
||||||
// to MPP options.
|
// to MPP options.
|
||||||
mpp := attempt.Route.FinalHop().MPP
|
mpp := attempt.Route.FinalHop().MPP
|
||||||
for _, h := range p.InFlightHTLCs() {
|
for _, h := range payment.InFlightHTLCs() {
|
||||||
hMpp := h.Route.FinalHop().MPP
|
hMpp := h.Route.FinalHop().MPP
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
@@ -358,13 +358,13 @@ func (p *PaymentControl) RegisterAttempt(paymentHash lntypes.Hash,
|
|||||||
// If this is a non-MPP attempt, it must match the total amount
|
// If this is a non-MPP attempt, it must match the total amount
|
||||||
// exactly.
|
// exactly.
|
||||||
amt := attempt.Route.ReceiverAmt()
|
amt := attempt.Route.ReceiverAmt()
|
||||||
if mpp == nil && amt != p.Info.Value {
|
if mpp == nil && amt != payment.Info.Value {
|
||||||
return ErrValueMismatch
|
return ErrValueMismatch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we aren't sending more than the total payment amount.
|
// Ensure we aren't sending more than the total payment amount.
|
||||||
sentAmt, _ := p.SentAmt()
|
sentAmt, _ := payment.SentAmt()
|
||||||
if sentAmt+amt > p.Info.Value {
|
if sentAmt+amt > payment.Info.Value {
|
||||||
return ErrValueExceedsAmt
|
return ErrValueExceedsAmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user