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

feat(SPV-912): handle invalid configuration #270

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

chris-4chain
Copy link
Contributor

Invalid previous behavior:
instance of WalletClient is created with empty authorizations fields

For example:
client := walletclient.NewWithXPriv("localhost:3003", "")
also when we use
client := walletclient.NewWithAccessKey("localhost:3003", "")
and
client := walletclient.NewWithAdminKey("localhost:3003", "")
and
client := walletclient.NewWithXPub("localhost:3003", "")

expected behavior: instance should not be created

The "constructor" functions now also return error:

NewWithXPriv(serverURL, xPriv string) (*WalletClient, error)
NewWithXPub(serverURL, xPub string) (*WalletClient, error)
NewWithAdminKey(serverURL, adminKey string) (*WalletClient, error)
NewWithAccessKey(serverURL, accessKey string) (*WalletClient, error)
  • The configurer instances besides configuring a client, make validation and return err if necessary.
  • SPVError type was used - with Wrap functionality.
  • The spv-wallet/models dependency was updated, because without it, the errors.Is didn't work with SPVError type.

Pull Request Checklist

  • 📖 I created my PR using provided : CODE_STANDARDS
  • 📖 I have read the short Code of Conduct: CODE_OF_CONDUCT
  • 🏠 I tested my changes locally.
  • ✅ I have provided tests for my changes.
  • 📝 I have used conventional commits.
  • 📗 I have updated any related documentation.
  • 💾 PR was issued based on the Github or Jira issue.

@chris-4chain chris-4chain requested a review from a team as a code owner September 27, 2024 11:46
Copy link
Contributor

github-actions bot commented Sep 27, 2024

Manual Tests

💚 Manual testing by @Nazarii-4chain resulted in success.

@Nazarii-4chain Nazarii-4chain added the tested PR was tested by a team member label Oct 2, 2024
@chris-4chain chris-4chain merged commit 30361c8 into main Oct 3, 2024
6 of 7 checks passed
@chris-4chain chris-4chain deleted the feat/SPV-912-handle-invalid-config branch October 3, 2024 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tested PR was tested by a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants