invoices: move log into update context
This commit is contained in:
parent
a339065fdc
commit
51324ac7ae
@ -780,11 +780,6 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
|
||||
|
||||
mpp := payload.MultiPath()
|
||||
|
||||
debugLog := func(s string) {
|
||||
log.Debugf("Invoice(%x): %v, amt=%v, expiry=%v, circuit=%v, "+
|
||||
"mpp=%v", rHash[:], s, amtPaid, expiry, circuitKey, mpp)
|
||||
}
|
||||
|
||||
// Create the update context containing the relevant details of the
|
||||
// incoming htlc.
|
||||
updateCtx := invoiceUpdateCtx{
|
||||
@ -804,7 +799,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
|
||||
if i.cfg.AcceptKeySend {
|
||||
err := i.processKeySend(updateCtx)
|
||||
if err != nil {
|
||||
debugLog(fmt.Sprintf("keysend error: %v", err))
|
||||
updateCtx.log(fmt.Sprintf("keysend error: %v", err))
|
||||
|
||||
return NewFailureResolution(
|
||||
circuitKey, currentHeight, ResultKeySendError,
|
||||
@ -852,11 +847,11 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
|
||||
case nil:
|
||||
|
||||
default:
|
||||
debugLog(err.Error())
|
||||
updateCtx.log(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
|
||||
debugLog(result.String())
|
||||
updateCtx.log(result.String())
|
||||
|
||||
if updateSubscribers {
|
||||
i.notifyClients(rHash, invoice, invoice.State)
|
||||
|
@ -180,6 +180,12 @@ type invoiceUpdateCtx struct {
|
||||
mpp *record.MPP
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// updateInvoice is a callback for DB.UpdateInvoice that contains the invoice
|
||||
// settlement logic.
|
||||
func updateInvoice(ctx *invoiceUpdateCtx, inv *channeldb.Invoice) (
|
||||
|
Loading…
Reference in New Issue
Block a user