Fix throw when toggling Tor with unopened cryptonote family wallets - #1275
Fix throw when toggling Tor with unopened cryptonote family wallets#1275sneurlax wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## staging #1275 +/- ##
===========================================
+ Coverage 4.82% 4.93% +0.10%
===========================================
Files 1064 1064
Lines 107929 108022 +93
===========================================
+ Hits 5212 5330 +118
+ Misses 102717 102692 -25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
db30ba4 to
4e93483
Compare
|
Comments: For example in https://www.github.com/cypherstack/stack_wallet/blob/211971b5d7c6cac19173071026388dbaf756e8ab/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart#L306-L339 |
Serializes open, node updates, native replacement and shutdown on a single mutex, and rejects queued work once shutdown has begun. The Tor transition gate parks a node update while Tor is bootstrapping and abandons it as soon as the operation is superseded.
Every LibMonero/Wownero/Salvium instance subscribed to the Tor status and preference events from its constructor, so toggling Tor ran updateNode() on the dozens of wallets Wallets.load() constructs but never opens. With a Tor-only or clearnet-only node the TOR/clearnet mismatch escaped the async listener as an unhandled exception. Listeners are now attached in open() and detached on exit() or a failed open, and the native lifecycle runs through CryptonoteWalletLifecycle so concurrent open/exit calls cannot load or tear down the native wallet twice. Because an exited wallet no longer follows node or Tor changes, open() re-runs the node update whenever the native daemon session was torn down; otherwise a reopened wallet resumes syncing over its stale clearnet session. Also corrects the inverted null guard in recoverViewOnly().
265568a to
914326d
Compare
When you toggle Tor with an uninitialized cryptonote wallet, it throws. This isn't fatal. The fix uses the same guard pattern other functions use.
This fix is admittedly optional: it's not a critical fix but rather a cosmetic/log-cleaning fix.