File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -469,6 +469,7 @@ export const useWallets = defineStore('wallets', () => {
469469 const database = await Database . getInstance ( ) ;
470470 await database . removeVault ( v . defaultKeyToExport ) ;
471471 for ( const wallet of v . wallets ) {
472+ await database . removeTxByXpub ( wallet . getKeyToExport ( ) ) ;
472473 await database . removeAccount ( {
473474 publicKey : wallet . getKeyToExport ( ) ,
474475 } ) ;
Original file line number Diff line number Diff line change @@ -20,9 +20,8 @@ export class Database {
2020 * Version 6 = Filter unconfirmed txs (#415)
2121 * Version 7 = Store shield params in indexed db (#511)
2222 * Version 8 = Multi MNs (#517)
23- * Version 9 = Store shield syncing data in indexed db (#543)
24- * Version 10 = Multi account system (#542)
25-
23+ * Version 9 = Store shield syncing data in indexed db (#543)
24+ * Version 10 = Multi account system (#542)
2625 * @type {number }
2726 */
2827 static version = 10 ;
@@ -246,7 +245,6 @@ export class Database {
246245 const store = this . #db
247246 . transaction ( 'accounts' , 'readwrite' )
248247 . objectStore ( 'accounts' ) ;
249- // When the account system is going to be added, the key is gonna be the publicKey
250248 await store . delete ( publicKey ) ;
251249 }
252250
@@ -467,6 +465,17 @@ export class Database {
467465 await store . clear ( ) ;
468466 }
469467
468+ async removeTxByXpub ( xpub ) {
469+ const tx = this . #db. transaction ( 'txs' , 'readwrite' ) ;
470+ const index = tx . store . index ( 'xpub' ) ;
471+
472+ let cursor = await index . openCursor ( IDBKeyRange . only ( xpub ) ) ;
473+ while ( cursor ) {
474+ await cursor . delete ( ) ;
475+ cursor = await cursor . continue ( ) ;
476+ }
477+ }
478+
470479 /**
471480 * @returns {Promise<Settings> }
472481 */
You can’t perform that action at this time.
0 commit comments