diff --git a/ironfish/src/wallet/walletdb/walletdb.ts b/ironfish/src/wallet/walletdb/walletdb.ts index 2f00cac016..f97272805f 100644 --- a/ironfish/src/wallet/walletdb/walletdb.ts +++ b/ironfish/src/wallet/walletdb/walletdb.ts @@ -418,7 +418,7 @@ export class WalletDB { async removeAccount(account: Account, tx?: IDatabaseTransaction): Promise { await this.db.withTransaction(tx, async (tx) => { await this.accounts.del(account.id, tx) - await this.clearBalance(account, tx) + await this.balances.clear(tx, account.prefixRange) await this.accountIdsToCleanup.put(account.id, null, tx) }) } @@ -542,19 +542,6 @@ export class WalletDB { await this.transactions.del([account.prefix, transactionHash], tx) } - async clearTransactions(account: Account, tx?: IDatabaseTransaction): Promise { - await this.transactions.clear(tx, account.prefixRange) - await this.timestampToTransactionHash.clear(tx, account.prefixRange) - } - - async clearSequenceToNoteHash(account: Account, tx?: IDatabaseTransaction): Promise { - await this.sequenceToNoteHash.clear(tx, account.prefixRange) - } - - async clearNonChainNoteHashes(account: Account, tx?: IDatabaseTransaction): Promise { - await this.nonChainNoteHashes.clear(tx, account.prefixRange) - } - async *getTransactionHashesBySequence( account: Account, tx?: IDatabaseTransaction, @@ -658,20 +645,6 @@ export class WalletDB { }) } - /* - * clears sequenceToNoteHash entries for all accounts for a given sequence - */ - async clearSequenceNoteHashes(sequence: number, tx?: IDatabaseTransaction): Promise { - const encoding = this.sequenceToNoteHash.keyEncoding - - const keyRange = StorageUtils.getPrefixesKeyRange( - encoding.serialize([Buffer.alloc(4, 0), [sequence, Buffer.alloc(0)]]), - encoding.serialize([Buffer.alloc(4, 255), [sequence, Buffer.alloc(0)]]), - ) - - await this.sequenceToNoteHash.clear(tx, keyRange) - } - async addUnspentNoteHash( account: Account, noteHash: Buffer, @@ -1027,10 +1000,6 @@ export class WalletDB { await this.decryptedNotes.del([account.prefix, noteHash], tx) } - async clearDecryptedNotes(account: Account, tx?: IDatabaseTransaction): Promise { - await this.decryptedNotes.clear(tx, account.prefixRange) - } - async *loadDecryptedNotes( account: Account, range?: DatabaseKeyRange, @@ -1088,10 +1057,6 @@ export class WalletDB { await this.balances.put([account.prefix, assetId], balance, tx) } - async clearBalance(account: Account, tx?: IDatabaseTransaction): Promise { - await this.balances.clear(tx, account.prefixRange) - } - async *loadExpiredTransactionHashes( account: Account, headSequence: number, @@ -1221,13 +1186,6 @@ export class WalletDB { await this.pendingTransactionHashes.del([account.prefix, [expiration, transactionHash]], tx) } - async clearPendingTransactionHashes( - account: Account, - tx?: IDatabaseTransaction, - ): Promise { - await this.pendingTransactionHashes.clear(tx, account.prefixRange) - } - async forceCleanupDeletedAccounts(signal?: AbortSignal): Promise { return this.cleanupDeletedAccounts(Number.POSITIVE_INFINITY, signal) }