mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
delete old derivations when doing full rescan
This commit is contained in:
parent
b348761bbe
commit
38453ceafb
7 changed files with 81 additions and 0 deletions
|
@ -2740,6 +2740,7 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
// await _rescanBackup();
|
||||
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2892,6 +2893,20 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
// Logging.instance.log("rescan backup complete", level: LogLevel.Info);
|
||||
// }
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
|
||||
// P2SH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
|
||||
|
||||
// P2WPKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2WPKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2WPKH");
|
||||
}
|
||||
|
||||
bool isActive = false;
|
||||
|
||||
@override
|
||||
|
|
|
@ -2812,6 +2812,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
|
||||
// clear blockchain info
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2846,6 +2847,16 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
|
||||
// P2SH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
|
||||
}
|
||||
|
||||
@override
|
||||
set isFavorite(bool markFavorite) {
|
||||
_isFavorite = markFavorite;
|
||||
|
|
|
@ -2439,6 +2439,7 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
|
||||
// clear blockchain info
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2476,6 +2477,12 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
}
|
||||
|
||||
// Future<void> _rescanRestore() async {
|
||||
// Logging.instance.log("starting rescan restore", level: LogLevel.Info);
|
||||
//
|
||||
|
|
|
@ -3616,6 +3616,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
|||
|
||||
// clear blockchain info
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -3649,6 +3650,12 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivations");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivations");
|
||||
}
|
||||
|
||||
// Future<void> _rescanBackup() async {
|
||||
// Logging.instance.log("starting rescan backup", level: LogLevel.Info);
|
||||
//
|
||||
|
|
|
@ -2828,6 +2828,7 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
|
||||
// clear blockchain info
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2865,6 +2866,20 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
|
||||
// P2SH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
|
||||
|
||||
// P2WPKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2WPKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2WPKH");
|
||||
}
|
||||
|
||||
// Future<void> _rescanRestore() async {
|
||||
// Logging.instance.log("starting rescan restore", level: LogLevel.Info);
|
||||
//
|
||||
|
|
|
@ -2817,6 +2817,7 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
|
||||
// clear blockchain info
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2854,6 +2855,20 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
|
||||
// P2SH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
|
||||
|
||||
// P2WPKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2WPKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2WPKH");
|
||||
}
|
||||
|
||||
// Future<void> _rescanRestore() async {
|
||||
// Logging.instance.log("starting rescan restore", level: LogLevel.Info);
|
||||
//
|
||||
|
|
|
@ -2904,6 +2904,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
// await _rescanBackup();
|
||||
|
||||
await db.deleteWalletBlockchainData(walletId);
|
||||
await _deleteDerivations();
|
||||
|
||||
try {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
|
@ -2941,6 +2942,16 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteDerivations() async {
|
||||
// P2PKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||
|
||||
// P2WPKH derivations
|
||||
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2WPKH");
|
||||
await _secureStore.delete(key: "${walletId}_changeDerivationsP2WPKH");
|
||||
}
|
||||
|
||||
// Future<void> _rescanRestore() async {
|
||||
// Logging.instance.log("starting rescan restore", level: LogLevel.Info);
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue