channeldb/invoices: add idempotency to SettleInvoice
This commit is contained in:
1 file changed
+6
@@ -432,6 +432,12 @@ func settleInvoice(invoices *bolt.Bucket, invoiceNum []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add idempotency to duplicate settles, return here to avoid
|
||||||
|
// overwriting the previous info.
|
||||||
|
if invoice.Terms.Settled {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
invoice.Terms.Settled = true
|
invoice.Terms.Settled = true
|
||||||
invoice.SettleDate = time.Now()
|
invoice.SettleDate = time.Now()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user