Merge pull request #318 from getAlby/dont-log-already-processed-keysend

don't log already processed keysend error
This commit is contained in:
kiwiidb
2023-02-18 11:39:23 +01:00
committed by GitHub

View File

@@ -5,6 +5,7 @@ import (
"crypto/sha256"
"database/sql"
"encoding/hex"
"errors"
"fmt"
"strconv"
"strings"
@@ -18,6 +19,8 @@ import (
"github.com/uptrace/bun"
)
var AlreadyProcessedKeysendError = errors.New("already processed keysend payment")
func (svc *LndhubService) HandleInternalKeysendPayment(ctx context.Context, invoice *models.Invoice) (result *models.Invoice, err error) {
//Find the payee user
user, err := svc.FindUserByLogin(ctx, string(invoice.DestinationCustomRecords[TLV_WALLET_ID]))
@@ -63,7 +66,7 @@ func (svc *LndhubService) HandleKeysendPayment(ctx context.Context, rawInvoice *
return err
}
if count != 0 {
return fmt.Errorf("Already processed keysend payment %s", rHashStr)
return AlreadyProcessedKeysendError
}
//construct the invoice
@@ -256,7 +259,7 @@ func (svc *LndhubService) InvoiceUpdateSubscription(ctx context.Context) error {
}
processingError := svc.ProcessInvoiceUpdate(ctx, rawInvoice)
if processingError != nil {
if processingError != nil && processingError != AlreadyProcessedKeysendError {
svc.Logger.Error(fmt.Errorf("Error %s, invoice hash %s", processingError.Error(), hex.EncodeToString(rawInvoice.RHash)))
sentry.CaptureException(fmt.Errorf("Error %s, invoice hash %s", processingError.Error(), hex.EncodeToString(rawInvoice.RHash)))
}