From 7a93c7530cfb21c0d04a47564751a16a9fef5f57 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 5 Feb 2018 19:46:19 -0800 Subject: [PATCH] channeldb/invoices: add idempotency to SettleInvoice --- channeldb/invoices.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/channeldb/invoices.go b/channeldb/invoices.go index 3614532ba..38f27aa27 100644 --- a/channeldb/invoices.go +++ b/channeldb/invoices.go @@ -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()