channeldb: split cancel and add htlc updates

Previously the cancel and add actions were combined in a single map.
Nil values implictly signaled cancel actions. This wasn't very obvious.
Furthermore this split prepares for processing the adds and cancels
separately, which is more efficient if there are already two maps.
This commit is contained in:
Joost Jager committed 2019-12-04 14:51:40 +01:00
1 parent c45891ecf7
commit a4a3c41924
4 files changed
+31 -28

No files matched your search

+3 -1
View File
@@ -130,7 +130,9 @@ func updateInvoice(ctx *invoiceUpdateCtx, inv *channeldb.Invoice) (
},
}
update := channeldb.InvoiceUpdateDesc{Htlcs: newHtlcs}
update := channeldb.InvoiceUpdateDesc{
AddHtlcs: newHtlcs,
}
// Don't update invoice state if we are accepting a duplicate payment.
// We do accept or settle the HTLC.