channeldb: split cancelHTLCs logic in the UpdateInvoice method
Previous to this commit we were able to call `UpdateInvoice` with an updated that added and cancelled htlcs at the same time. The function returned an error if there was overlapping between the two htlc set. However, that behavior was not used in the LND code itself. Eventually we want to split this method in multiple ones, among them one for canceling htlcs and another one for adding them. For that reason, this behavior is not supported anymore.
This commit is contained in:
3 files changed
+83
-45
No files matched your search
@@ -479,6 +479,7 @@ func TestInvoiceCancelSingleHtlc(t *testing.T) {
|
||||
invoice *invpkg.Invoice) (*invpkg.InvoiceUpdateDesc, error) {
|
||||
|
||||
return &invpkg.InvoiceUpdateDesc{
|
||||
UpdateType: invpkg.CancelHTLCsUpdate,
|
||||
CancelHtlcs: map[models.CircuitKey]struct{}{
|
||||
key: {},
|
||||
},
|
||||
@@ -554,6 +555,7 @@ func TestInvoiceCancelSingleHtlcAMP(t *testing.T) {
|
||||
invoice *invpkg.Invoice) (*invpkg.InvoiceUpdateDesc, error) {
|
||||
|
||||
return &invpkg.InvoiceUpdateDesc{
|
||||
UpdateType: invpkg.CancelHTLCsUpdate,
|
||||
CancelHtlcs: map[models.CircuitKey]struct{}{
|
||||
{HtlcID: 0}: {},
|
||||
},
|
||||
@@ -616,6 +618,7 @@ func TestInvoiceCancelSingleHtlcAMP(t *testing.T) {
|
||||
error) {
|
||||
|
||||
return &invpkg.InvoiceUpdateDesc{
|
||||
UpdateType: invpkg.CancelHTLCsUpdate,
|
||||
CancelHtlcs: map[models.CircuitKey]struct{}{
|
||||
{HtlcID: 1}: {},
|
||||
},
|
||||
@@ -643,6 +646,7 @@ func TestInvoiceCancelSingleHtlcAMP(t *testing.T) {
|
||||
invoice *invpkg.Invoice) (*invpkg.InvoiceUpdateDesc, error) {
|
||||
|
||||
return &invpkg.InvoiceUpdateDesc{
|
||||
UpdateType: invpkg.CancelHTLCsUpdate,
|
||||
CancelHtlcs: map[models.CircuitKey]struct{}{
|
||||
{HtlcID: 2}: {},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user