@@ -659,8 +659,9 @@ func (i *InvoiceRegistry) cancelSingleHtlc(invoiceRef InvoiceRef,
659
659
660
660
// Only allow individual htlc cancellation on open invoices.
661
661
if invoice .State != ContractOpen {
662
- log .Debugf ("cancelSingleHtlc: invoice %v no longer " +
663
- "open" , invoiceRef )
662
+ log .Debugf ("CancelSingleHtlc: cannot cancel htlc %v " +
663
+ "on invoice %v, invoice is no longer open" , key ,
664
+ invoiceRef )
664
665
665
666
return nil , nil
666
667
}
@@ -678,13 +679,13 @@ func (i *InvoiceRegistry) cancelSingleHtlc(invoiceRef InvoiceRef,
678
679
// Cancellation is only possible if the htlc wasn't already
679
680
// resolved.
680
681
if htlcState != HtlcStateAccepted {
681
- log .Debugf ("cancelSingleHtlc : htlc %v on invoice %v " +
682
+ log .Debugf ("CancelSingleHtlc : htlc %v on invoice %v " +
682
683
"is already resolved" , key , invoiceRef )
683
684
684
685
return nil , nil
685
686
}
686
687
687
- log .Debugf ("cancelSingleHtlc : cancelling htlc %v on invoice %v" ,
688
+ log .Debugf ("CancelSingleHtlc : cancelling htlc %v on invoice %v" ,
688
689
key , invoiceRef )
689
690
690
691
// Return an update descriptor that cancels htlc and keeps
@@ -737,8 +738,9 @@ func (i *InvoiceRegistry) cancelSingleHtlc(invoiceRef InvoiceRef,
737
738
key , int32 (htlc .AcceptHeight ), result ,
738
739
)
739
740
740
- log .Debugf ("Cancelling htlc (%v) of invoice(%v) with " +
741
- "resolution: %v" , key , invoiceRef , result )
741
+ log .Debugf ("Signaling htlc(%v) cancellation of invoice(%v) " +
742
+ "with resolution(%v) to the link subsystem" , key ,
743
+ invoiceRef , result )
742
744
743
745
i .notifyHodlSubscribers (resolution )
744
746
}
@@ -1457,6 +1459,8 @@ func (i *InvoiceRegistry) cancelInvoiceImpl(ctx context.Context,
1457
1459
}
1458
1460
1459
1461
invoiceRef := InvoiceRefByHash (payHash )
1462
+
1463
+ // We pass a nil setID which means no HTLCs will be read out.
1460
1464
invoice , err := i .idb .UpdateInvoice (ctx , invoiceRef , nil , updateInvoice )
1461
1465
1462
1466
// Implement idempotency by returning success if the invoice was already
@@ -1483,6 +1487,8 @@ func (i *InvoiceRegistry) cancelInvoiceImpl(ctx context.Context,
1483
1487
// that are waiting for resolution. Any htlcs that were already canceled
1484
1488
// before, will be notified again. This isn't necessary but doesn't hurt
1485
1489
// either.
1490
+ //
1491
+ // TODO(ziggie): Also consider AMP HTLCs here.
1486
1492
for key , htlc := range invoice .Htlcs {
1487
1493
if htlc .State != HtlcStateCanceled {
1488
1494
continue
0 commit comments