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

Add errors for Solana cases that precede confirmed #2544

Merged
merged 16 commits into from
Jun 13, 2024

Conversation

Sneagan
Copy link
Contributor

@Sneagan Sneagan commented May 30, 2024

Summary

Closes #2525

Type of Change

  • Product feature
  • Bug fix
  • Performance improvement
  • Refactor
  • Other

Tested Environments

  • Development
  • Staging
  • Production

Before Requesting Review

  • Does your code build cleanly without any errors or warnings?
  • Have you used auto closing keywords?
  • Have you added tests for new functionality?
  • Have validated query efficiency for new database queries?
  • Have documented new functionality in README or in comments?
  • Have you squashed all intermediate commits?
  • Is there a clear title that explains what the PR does?
  • Have you used intuitive function, variable and other naming?
  • Have you requested security and/or privacy review if needed
  • Have you performed a self review of this PR?

Manual Test Plan

@Sneagan Sneagan requested review from a team as code owners May 30, 2024 20:35
Copy link
Contributor

@pavelbrm pavelbrm left a comment

Choose a reason for hiding this comment

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

Looking better. Left a few non-blocking suggestions.

services/payments/errors.go Outdated Show resolved Hide resolved
Comment on lines +237 to +240
if persistedState != nil &&
persistedState.ExternalIdempotency != nil &&
state.ExternalIdempotency != nil &&
!bytes.Equal(state.ExternalIdempotency, persistedState.ExternalIdempotency) {
Copy link
Contributor

Choose a reason for hiding this comment

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

At some point (soon) it might be good to extract this into a separate predicate to be able to test it in isolation.

Comment on lines +218 to +220
if errors.Is(err, SolanaTransactionNotConfirmedError) ||
errors.Is(err, SolanaTransactionNotFoundError) ||
errors.Is(err, SolanaTransactionUnknownError) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also be extracted into a helper predicate:

func isErrSolanaTransaction(err error) bool {
	if err == nil {
		return false
	}
	
	return errors.Is(err, SolanaTransactionNotConfirmedError) || errors.Is(err, SolanaTransactionNotFoundError) || errors.Is(err, SolanaTransactionUnknownError)
}

tools/payments/cmd/authorize/main.go Show resolved Hide resolved
@Sneagan Sneagan merged commit 3152fae into nitro-payments-dev Jun 13, 2024
2 checks passed
@Sneagan Sneagan deleted the feature/unconfirmed-as-error_#2525 branch June 13, 2024 20:17
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.

3 participants