mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
clear out isar blockchain data per wallet when doing full rescan
This commit is contained in:
parent
061658f2e9
commit
8a7236b46d
9 changed files with 75 additions and 3 deletions
|
@ -2801,9 +2801,11 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
|
|
||||||
// clear blockchain info
|
// clear blockchain info
|
||||||
await isar.writeTxn(() async {
|
await isar.writeTxn(() async {
|
||||||
await isar.addresses.clear();
|
|
||||||
await isar.transactions.clear();
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
await isar.utxos.clear();
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2435,6 +2435,15 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// back up data
|
// back up data
|
||||||
// await _rescanBackup();
|
// await _rescanBackup();
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||||
await _recoverWalletFromBIP32SeedPhrase(
|
await _recoverWalletFromBIP32SeedPhrase(
|
||||||
|
|
|
@ -904,6 +904,15 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
await epicUpdateLastScannedBlock(await getRestoreHeight());
|
await epicUpdateLastScannedBlock(await getRestoreHeight());
|
||||||
|
|
||||||
if (!await startScans()) {
|
if (!await startScans()) {
|
||||||
|
|
|
@ -3596,6 +3596,15 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
||||||
// back up data
|
// back up data
|
||||||
// await _rescanBackup();
|
// await _rescanBackup();
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||||
await _recoverWalletFromBIP32SeedPhrase(mnemonic!, maxUnusedAddressGap);
|
await _recoverWalletFromBIP32SeedPhrase(mnemonic!, maxUnusedAddressGap);
|
||||||
|
|
|
@ -2823,6 +2823,15 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// back up data
|
// back up data
|
||||||
// await _rescanBackup();
|
// await _rescanBackup();
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||||
await _recoverWalletFromBIP32SeedPhrase(
|
await _recoverWalletFromBIP32SeedPhrase(
|
||||||
|
|
|
@ -215,6 +215,15 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
int maxUnusedAddressGap,
|
int maxUnusedAddressGap,
|
||||||
int maxNumberOfIndexesToCheck,
|
int maxNumberOfIndexesToCheck,
|
||||||
) async {
|
) async {
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
var restoreHeight = walletBase?.walletInfo.restoreHeight;
|
var restoreHeight = walletBase?.walletInfo.restoreHeight;
|
||||||
highestPercentCached = 0;
|
highestPercentCached = 0;
|
||||||
await walletBase?.rescan(height: restoreHeight);
|
await walletBase?.rescan(height: restoreHeight);
|
||||||
|
|
|
@ -2812,6 +2812,15 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// back up data
|
// back up data
|
||||||
// await _rescanBackup();
|
// await _rescanBackup();
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||||
await _recoverWalletFromBIP32SeedPhrase(
|
await _recoverWalletFromBIP32SeedPhrase(
|
||||||
|
|
|
@ -1992,8 +1992,6 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
coin: coin,
|
coin: coin,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Logging.instance.log("TRANSACTION: ${jsonEncode(tx)}");
|
|
||||||
// TODO fix this for sent to self transactions?
|
|
||||||
if (!_duplicateTxCheck(allTransactions, tx["txid"] as String)) {
|
if (!_duplicateTxCheck(allTransactions, tx["txid"] as String)) {
|
||||||
tx["address"] = await isar.addresses
|
tx["address"] = await isar.addresses
|
||||||
.filter()
|
.filter()
|
||||||
|
@ -2898,6 +2896,15 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// back up data
|
// back up data
|
||||||
// await _rescanBackup();
|
// await _rescanBackup();
|
||||||
|
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||||
await _recoverWalletFromBIP32SeedPhrase(
|
await _recoverWalletFromBIP32SeedPhrase(
|
||||||
|
|
|
@ -238,6 +238,15 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
int maxUnusedAddressGap,
|
int maxUnusedAddressGap,
|
||||||
int maxNumberOfIndexesToCheck,
|
int maxNumberOfIndexesToCheck,
|
||||||
) async {
|
) async {
|
||||||
|
// clear blockchain info
|
||||||
|
await isar.writeTxn(() async {
|
||||||
|
await isar.transactions.clear();
|
||||||
|
await isar.inputs.clear();
|
||||||
|
await isar.outputs.clear();
|
||||||
|
await isar.utxos.clear();
|
||||||
|
await isar.addresses.clear();
|
||||||
|
});
|
||||||
|
|
||||||
var restoreHeight = walletBase?.walletInfo.restoreHeight;
|
var restoreHeight = walletBase?.walletInfo.restoreHeight;
|
||||||
highestPercentCached = 0;
|
highestPercentCached = 0;
|
||||||
await walletBase?.rescan(height: restoreHeight);
|
await walletBase?.rescan(height: restoreHeight);
|
||||||
|
|
Loading…
Reference in a new issue