mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
fix cw wallet listeners on restore
This commit is contained in:
parent
642f0906b8
commit
7d60793c88
2 changed files with 8 additions and 4 deletions
|
@ -529,6 +529,11 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
walletInfo.address = wallet.walletAddresses.address;
|
||||
await DB.instance
|
||||
.add<WalletInfo>(boxName: WalletInfo.boxName, value: walletInfo);
|
||||
cwWalletBase?.close();
|
||||
cwWalletBase = wallet as MoneroWalletBase;
|
||||
cwWalletBase?.onNewBlock = onNewBlock;
|
||||
cwWalletBase?.onNewTransaction = onNewTransaction;
|
||||
cwWalletBase?.syncStatusChanged = syncStatusChanged;
|
||||
if (walletInfo.address != null) {
|
||||
final newReceivingAddress = await getCurrentReceivingAddress() ??
|
||||
Address(
|
||||
|
@ -547,15 +552,12 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
isar: mainDB.isar,
|
||||
);
|
||||
}
|
||||
cwWalletBase?.close();
|
||||
cwWalletBase = wallet as MoneroWalletBase;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("$e\n$s", level: LogLevel.Fatal);
|
||||
}
|
||||
await updateNode();
|
||||
|
||||
await cwWalletBase?.rescan(height: credentials.height);
|
||||
cwWalletBase?.close();
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
|
||||
|
|
|
@ -577,6 +577,9 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
.add<WalletInfo>(boxName: WalletInfo.boxName, value: walletInfo);
|
||||
cwWalletBase?.close();
|
||||
cwWalletBase = wallet;
|
||||
cwWalletBase?.onNewBlock = onNewBlock;
|
||||
cwWalletBase?.onNewTransaction = onNewTransaction;
|
||||
cwWalletBase?.syncStatusChanged = syncStatusChanged;
|
||||
if (walletInfo.address != null) {
|
||||
final newReceivingAddress = await getCurrentReceivingAddress() ??
|
||||
Address(
|
||||
|
@ -601,7 +604,6 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
await updateNode();
|
||||
|
||||
await cwWalletBase?.rescan(height: credentials.height);
|
||||
cwWalletBase?.close();
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
|
||||
|
|
Loading…
Reference in a new issue