mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 13:42:46 +02:00
invoices: allow overpayment in mpps
This commit is contained in:
@@ -214,11 +214,6 @@ func updateMpp(ctx *invoiceUpdateCtx, inv *Invoice) (*InvoiceUpdateDesc,
|
|||||||
// Add amount of new htlc.
|
// Add amount of new htlc.
|
||||||
newSetTotal += ctx.amtPaid
|
newSetTotal += ctx.amtPaid
|
||||||
|
|
||||||
// Make sure the communicated set total isn't overpaid.
|
|
||||||
if newSetTotal > ctx.mpp.TotalMsat() {
|
|
||||||
return nil, ctx.failRes(ResultHtlcSetOverpayment), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// The invoice is still open. Check the expiry.
|
// The invoice is still open. Check the expiry.
|
||||||
if ctx.expiry < uint32(ctx.currentHeight+ctx.finalCltvRejectDelta) {
|
if ctx.expiry < uint32(ctx.currentHeight+ctx.finalCltvRejectDelta) {
|
||||||
return nil, ctx.failRes(ResultExpiryTooSoon), nil
|
return nil, ctx.failRes(ResultExpiryTooSoon), nil
|
||||||
@@ -243,7 +238,7 @@ func updateMpp(ctx *invoiceUpdateCtx, inv *Invoice) (*InvoiceUpdateDesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the invoice cannot be settled yet, only record the htlc.
|
// If the invoice cannot be settled yet, only record the htlc.
|
||||||
setComplete := newSetTotal == ctx.mpp.TotalMsat()
|
setComplete := newSetTotal >= ctx.mpp.TotalMsat()
|
||||||
if !setComplete {
|
if !setComplete {
|
||||||
return &update, ctx.acceptRes(resultPartialAccepted), nil
|
return &update, ctx.acceptRes(resultPartialAccepted), nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user