-
Notifications
You must be signed in to change notification settings - Fork 20
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: Handle wallet sync error during startup #2090
Conversation
179a336
to
95c60e5
Compare
8e7f11f
to
4d1cd9a
Compare
4d1cd9a
to
1105e9b
Compare
@@ -369,10 +369,14 @@ pub fn run(seed_dir: String, runtime: &Runtime) -> Result<()> { | |||
// TODO: This might not be necessary once we rewrite the on-chain wallet with bdk:1.0.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃 We might want to hold off on this change until after #2094 is merged. We might not even need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will probably not need it for the on-chain sync. But the off-chain balance will definitely fail in regards to the linked issue, since the contract was not backed up breaking the restored app.
let on_chain_balance = self.inner.get_on_chain_balance()?; | ||
let on_chain = on_chain_balance.confirmed + on_chain_balance.trusted_pending; | ||
pub fn get_wallet_balances(&self) -> Balances { | ||
let on_chain = match self.inner.get_on_chain_balance() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The on-chain balance will actually be infallible very soon :D
@@ -18,28 +18,35 @@ class _BalanceRowState extends State<BalanceRow> with SingleTickerProviderStateM | |||
Widget build(BuildContext context) { | |||
WalletChangeNotifier walletChangeNotifier = context.watch<WalletChangeNotifier>(); | |||
|
|||
final offchainBalance = walletChangeNotifier.offChain()?.formatted() ?? "n/a"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Better than a zero or nothing at all.
I wonder if we should eventually use skeletons during loading and just display an error pop-up if some key data cannot be loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should eventually use skeletons during loading and just display an error pop-up if some key data cannot be loaded.
Can you elaborate? I am not sure I completely follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking about a nicer way to display information that is not yet available, and also information that we have failed to load.
In this case, showing a skeleton until the balance is available would be cool. But I'm not sure what would be the nicest way to display the fact that the balance could not be loaded. The label n/a
is serviceable, but probably not the nicest.
Let the app start even if the wallet sync fails.
Better to let the app start with what balance information we can get, than without anything.
If the wallet sync on-chain or off-chain fails the corresponding wallet info is none, which will tell the user that we couldn't sync their balance. Better than just showing 0.
1105e9b
to
8b2625e
Compare
Let the app start even if the wallet sync fails.
If the wallet sync fails the balance will be set to
None
, telling the UI that we were unable to determine the balance.fixes: #2075