Skip to content

Fix race when returning tip #244

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

Merged
merged 3 commits into from
May 28, 2025
Merged

Fix race when returning tip #244

merged 3 commits into from
May 28, 2025

Conversation

peterjan
Copy link
Member

No description provided.

@github-project-automation github-project-automation bot moved this to In Progress in Sia May 28, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a race condition when returning the wallet tip and refactors the initialization order within the SingleAddressWallet constructor. Key changes include replacing direct field access with a thread-safe Tip() accessor and reorganizing field initializations for clarity and consistency.

Comments suppressed due to low confidence (2)

wallet/wallet.go:453

  • Ensure that the Tip() method is implemented with proper synchronization to avoid further concurrency issues, as this change is intended to fix the race condition.
return sw.Tip(), nil, nil

wallet/wallet.go:1014

  • [nitpick] Reordering the field initializations improves clarity; please verify that this order is consistent with the struct definition and does not introduce unintended side effects.
addr: types.StandardUnlockHash(priv.PublicKey()),

ChrisSchinnerl
ChrisSchinnerl previously approved these changes May 28, 2025
@lukechampine lukechampine merged commit 310f98f into master May 28, 2025
11 checks passed
@lukechampine lukechampine deleted the pj/fix-race branch May 28, 2025 15:39
@github-project-automation github-project-automation bot moved this from In Progress to Done in Sia May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants