From 197a2a1f19efff31bcba2b4931fef74537eb4abd Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 13 Feb 2023 12:13:30 -0600 Subject: [PATCH] do not check addresses until refresh initiated --- lib/services/coins/bitcoin/bitcoin_wallet.dart | 6 +++--- .../coins/bitcoincash/bitcoincash_wallet.dart | 6 +++--- .../coins/dogecoin/dogecoin_wallet.dart | 6 +++--- .../coins/epiccash/epiccash_wallet.dart | 2 +- lib/services/coins/firo/firo_wallet.dart | 6 +++--- .../coins/litecoin/litecoin_wallet.dart | 6 +++--- lib/services/coins/monero/monero_wallet.dart | 18 +++--------------- .../coins/namecoin/namecoin_wallet.dart | 6 +++--- lib/services/coins/particl/particl_wallet.dart | 6 +++--- lib/services/coins/wownero/wownero_wallet.dart | 4 ++-- 10 files changed, 27 insertions(+), 39 deletions(-) diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index 1c93321eb..59726fdaa 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -1267,7 +1267,7 @@ class BitcoinWallet extends CoinServiceAPI @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1276,8 +1276,8 @@ class BitcoinWallet extends CoinServiceAPI } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // hack to add tx to txData before refresh completes diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index 8c12af9aa..b9aae718a 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -1195,7 +1195,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB { @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1204,8 +1204,8 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB { } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // hack to add tx to txData before refresh completes diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index c5e568381..ba5d294d7 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -1062,7 +1062,7 @@ class DogecoinWallet extends CoinServiceAPI @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1071,8 +1071,8 @@ class DogecoinWallet extends CoinServiceAPI } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // hack to add tx to txData before refresh completes diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index 4bd4f4b31..e582f7f80 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -981,7 +981,7 @@ class EpicCashWallet extends CoinServiceAPI @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet", level: LogLevel.Info); final config = await getRealConfig(); diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 7b7f5cb98..a0addd441 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -1856,7 +1856,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { @override Future initializeExisting() async { Logging.instance.log( - "Opening existing $_walletId ${coin.prettyName} wallet.", + "initializeExisting() $_walletId ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1864,8 +1864,8 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { "Attempted to initialize an existing wallet using an unknown wallet ID!"); } await _prefs.init(); - await checkChangeAddressForTransactions(); - await checkReceivingAddressForTransactions(); + // await checkChangeAddressForTransactions(); + // await checkReceivingAddressForTransactions(); } Future refreshIfThereIsNewData() async { diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index c8b69c8c8..33bcb1df7 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -1191,7 +1191,7 @@ class LitecoinWallet extends CoinServiceAPI @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1199,8 +1199,8 @@ class LitecoinWallet extends CoinServiceAPI "Attempted to initialize an existing wallet using an unknown wallet ID!"); } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // hack to add tx to txData before refresh completes diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index 8c956bb76..d8aaee0c1 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -258,7 +258,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { @override Future initializeExisting() async { Logging.instance.log( - "Opening existing ${coin.prettyName} wallet $walletName...", + "initializeExisting() ${coin.prettyName} wallet $walletName...", level: LogLevel.Info, ); @@ -289,24 +289,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { walletBase = (await walletService!.openWallet(_walletId, password)) as MoneroWalletBase; - await _checkCurrentReceivingAddressesForTransactions(); - // walletBase!.onNewBlock = onNewBlock; - // walletBase!.onNewTransaction = onNewTransaction; - // walletBase!.syncStatusChanged = syncStatusChanged; + // await _checkCurrentReceivingAddressesForTransactions(); + Logging.instance.log( "Opened existing ${coin.prettyName} wallet $walletName", level: LogLevel.Info, ); - // Wallet already exists, triggers for a returning user - - // String indexKey = "receivingIndex"; - // final curIndex = - // await DB.instance.get(boxName: walletId, key: indexKey) as int; - // // Use new index to derive a new receiving address - // final newReceivingAddress = await _generateAddressForChain(0, curIndex); - // Logging.instance.log("xmr address in init existing: $newReceivingAddress", - // level: LogLevel.Info); - // _currentReceivingAddress = Future(() => newReceivingAddress); } @override diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index 3be5ad6d7..967de16bf 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -1181,7 +1181,7 @@ class NamecoinWallet extends CoinServiceAPI @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1189,8 +1189,8 @@ class NamecoinWallet extends CoinServiceAPI "Attempted to initialize an existing wallet using an unknown wallet ID!"); } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // hack to add tx to txData before refresh completes diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 577bf2def..84460ec27 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -1107,7 +1107,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB { @override Future initializeExisting() async { - Logging.instance.log("Opening existing ${coin.prettyName} wallet.", + Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.", level: LogLevel.Info); if (getCachedId() == null) { @@ -1115,8 +1115,8 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB { "Attempted to initialize an existing wallet using an unknown wallet ID!"); } await _prefs.init(); - await _checkCurrentChangeAddressesForTransactions(); - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentChangeAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); } // TODO make sure this copied implementation from bitcoin_wallet.dart applies for particl just as well--or import it diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index 044f377a3..c10a37728 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -281,7 +281,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { @override Future initializeExisting() async { Logging.instance.log( - "Opening existing ${coin.prettyName} wallet $walletName...", + "initializeExisting() ${coin.prettyName} wallet $walletName...", level: LogLevel.Info); if (getCachedId() == null) { @@ -306,7 +306,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { walletBase = (await walletService?.openWallet(_walletId, password!)) as WowneroWalletBase; - await _checkCurrentReceivingAddressesForTransactions(); + // await _checkCurrentReceivingAddressesForTransactions(); Logging.instance.log( "Opened existing ${coin.prettyName} wallet $walletName",