Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more logs #110

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/cashu/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ func TestChangeProofsStateToPendingAndQuoteSet(t *testing.T) {
if proofs[0].State != PROOF_PENDING {
t.Errorf("proof transformation not working, should be: %v ", proofs[1].State)
}
res := "123"
res := "123"
if *proofs[0].Quote != res {
t.Errorf("proof transformation not working, should be: %v. is: ", "123")
t.Errorf("proof transformation not working, should be: %v. is: ", "123")
}
if proofs[1].State != PROOF_PENDING {
t.Errorf("proof transformation not working, should be: %v ", proofs[1].State)
Expand Down
4 changes: 3 additions & 1 deletion internal/routes/bolt11.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func v1bolt11Routes(r *gin.Engine, mint *mint.Mint, logger *slog.Logger) {
}

if len(knownProofs) != 0 {
logger.Info("Proofs already used", slog.String(utils.LogExtraInfo, fmt.Sprintf("%+v", knownProofs)))
logger.Info("Proofs already used", slog.String(utils.LogExtraInfo, fmt.Sprintf("knownproofs: %+v", knownProofs)))
c.JSON(400, cashu.ErrorCodeToResponse(cashu.TOKEN_ALREADY_SPENT, nil))
return
}
Expand All @@ -517,6 +517,8 @@ func v1bolt11Routes(r *gin.Engine, mint *mint.Mint, logger *slog.Logger) {

// Hardened error handling
if err != nil || payment.PaymentState == lightning.FAILED || payment.PaymentState == lightning.UNKNOWN {
logger.Warn("Possible payment failure", slog.String(utils.LogExtraInfo, fmt.Sprintf("error: %+v. payment: %+v", err, payment)))

// if exception of lightning payment says fail do a payment status recheck.
status, _, err := mint.LightningBackend.CheckPayed(quote.Quote)

Expand Down
2 changes: 1 addition & 1 deletion internal/routes/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func v1MintRoutes(r *gin.Engine, mint *m.Mint, logger *slog.Logger) {
}

if len(knownProofs) != 0 {
logger.Error("Proofs spent", slog.String(utils.LogExtraInfo, fmt.Sprintf("know proofs: %+v", knownProofs)))
logger.Warn("Proofs already spent", slog.String(utils.LogExtraInfo, fmt.Sprintf("know proofs: %+v", knownProofs)))
c.JSON(400, cashu.ErrorCodeToResponse(cashu.TOKEN_ALREADY_SPENT, nil))
return
}
Expand Down
Loading