channeldb/invoices: add idempotency to SettleInvoice

This commit is contained in:
Conner Fromknecht 2018-02-05 19:46:19 -08:00
parent e4d2958f68
commit 7a93c7530c
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

@ -432,6 +432,12 @@ func settleInvoice(invoices *bolt.Bucket, invoiceNum []byte) error {
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.SettleDate = time.Now()