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

fix: implemented network error handling for verify payment #153

Closed

Conversation

Toheeb-Ojuolape
Copy link

What type of PR is this? (check all applicable)

  • ♻️ Refactor
  • ✨ New Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 👷 Example Application
  • 🧑‍💻 Code Snippet
  • 🎨 Design
  • 📖 Content
  • 🧪 Tests
  • 🔖 Release
  • 🚩 Other

Description

This PR implements a try-and-catch block for the verifyPayment method in invoice.ts and returns false if a network error occurs

Related Tickets & Documents

Resolves #125

Copy link

socket-security bot commented Oct 6, 2024

src/invoice.ts Outdated

return json.settled;
} catch (error) {
console.error("A network error occurred");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.error("A network error occurred");
console.error("failed to check LNURL-verify", error);

This doesn't swallow the error (which is not necessarily a network error)

@rolznz
Copy link
Contributor

rolznz commented Oct 7, 2024

@Toheeb-Ojuolape thanks for the PR!

Can you please undo the changes to the lock files, they should not be in here.

@Toheeb-Ojuolape
Copy link
Author

@Toheeb-Ojuolape thanks for the PR!

Can you please undo the changes to the lock files, they should not be in here.

Hi @rolznz . This is done! Thank you so much for reviewing my PR

@rolznz
Copy link
Contributor

rolznz commented Oct 7, 2024

@Toheeb-Ojuolape
Copy link
Author

@Toheeb-Ojuolape please look at https://github.com/getAlby/js-lightning-tools/pull/153/files

Hi @rolznz I think I see the issue. When I committed the first time, a commit linter ran which updated yarn.lock. Since my update isn't really a big change, I'll squash this PR and create a new one and use the --no-verify flag to ensure the yarn.lock file or no other file is updated. Thank you @rolznz .

@Toheeb-Ojuolape Toheeb-Ojuolape deleted the verifypayment-fix branch October 7, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LNURL-verify verifyPayment function should handle fetch errors
2 participants