channeldb+invoices: track invoices by InvoiceRef

This commit is contained in:
Conner Fromknecht committed 2020-05-26 18:55:27 -07:00
1 parent 2799202fd9
commit 3522f09a08
5 files changed
+151 -76

No files matched your search

+8 -2
View File
@@ -22,10 +22,16 @@ type invoiceUpdateCtx struct {
mpp *record.MPP
}
// invoiceRef returns an identifier that can be used to lookup or update the
// invoice this HTLC is targeting.
func (i *invoiceUpdateCtx) invoiceRef() channeldb.InvoiceRef {
return channeldb.InvoiceRefByHash(i.hash)
}
// log logs a message specific to this update context.
func (i *invoiceUpdateCtx) log(s string) {
log.Debugf("Invoice(%x): %v, amt=%v, expiry=%v, circuit=%v, mpp=%v",
i.hash[:], s, i.amtPaid, i.expiry, i.circuitKey, i.mpp)
log.Debugf("Invoice%v: %v, amt=%v, expiry=%v, circuit=%v, mpp=%v",
i.invoiceRef, s, i.amtPaid, i.expiry, i.circuitKey, i.mpp)
}
// failRes is a helper function which creates a failure resolution with