From 478abfa1b2c218cd87ecb6327803796e89c326ec Mon Sep 17 00:00:00 2001 From: Hugh Cunningham Date: Tue, 12 Nov 2024 15:43:10 -0800 Subject: [PATCH] removes unused methods from walletDb cleans up the walletDb by removing unused methods removes one unused wallet method that was the only usage of a walletDb method --- ironfish/src/wallet/account/account.ts | 10 ----- ironfish/src/wallet/walletdb/walletdb.ts | 56 ------------------------ 2 files changed, 66 deletions(-) diff --git a/ironfish/src/wallet/account/account.ts b/ironfish/src/wallet/account/account.ts index fc21d97f2d..51f45a4aed 100644 --- a/ironfish/src/wallet/account/account.ts +++ b/ironfish/src/wallet/account/account.ts @@ -845,16 +845,6 @@ export class Account { } } - async *getTransactionsOrderedBySequence( - tx?: IDatabaseTransaction, - ): AsyncGenerator> { - for await (const { hash } of this.walletDb.getTransactionHashesBySequence(this, tx)) { - const transaction = await this.getTransaction(hash, tx) - Assert.isNotUndefined(transaction) - yield transaction - } - } - getPendingTransactions( headSequence: number, tx?: IDatabaseTransaction, diff --git a/ironfish/src/wallet/walletdb/walletdb.ts b/ironfish/src/wallet/walletdb/walletdb.ts index f97272805f..0590c1d1ce 100644 --- a/ironfish/src/wallet/walletdb/walletdb.ts +++ b/ironfish/src/wallet/walletdb/walletdb.ts @@ -482,14 +482,6 @@ export class WalletDB { await this.heads.del(account.id, tx) } - async *loadHeads( - tx?: IDatabaseTransaction, - ): AsyncGenerator<{ accountId: string; head: HeadValue | null }, void, unknown> { - for await (const [accountId, head] of this.heads.getAllIter(tx)) { - yield { accountId, head } - } - } - async saveTransaction( account: Account, transactionHash: Buffer, @@ -542,19 +534,6 @@ export class WalletDB { await this.transactions.del([account.prefix, transactionHash], tx) } - async *getTransactionHashesBySequence( - account: Account, - tx?: IDatabaseTransaction, - ): AsyncGenerator<{ sequence: number; hash: Buffer }> { - for await (const [, [sequence, hash]] of this.sequenceToTransactionHash.getAllKeysIter( - tx, - account.prefixRange, - { ordered: true }, - )) { - yield { sequence, hash } - } - } - async *loadTransactions( account: Account, range?: DatabaseKeyRange, @@ -831,24 +810,6 @@ export class WalletDB { } } - async *loadNullifierToNoteHash( - account: Account, - tx?: IDatabaseTransaction, - ): AsyncGenerator<{ - nullifier: Buffer - noteHash: Buffer - }> { - for await (const [[_, nullifier], noteHash] of this.nullifierToNoteHash.getAllIter( - tx, - account.prefixRange, - )) { - yield { - nullifier, - noteHash, - } - } - } - async deleteNullifier( account: Account, nullifier: Buffer, @@ -1142,19 +1103,6 @@ export class WalletDB { } } - async saveSequenceToTransactionHash( - account: Account, - sequence: number, - transactionHash: Buffer, - tx?: IDatabaseTransaction, - ): Promise { - await this.sequenceToTransactionHash.put( - [account.prefix, [sequence, transactionHash]], - null, - tx, - ) - } - async deleteSequenceToTransactionHash( account: Account, sequence: number, @@ -1406,10 +1354,6 @@ export class WalletDB { return this.multisigIdentities.get(identity, tx) } - async hasMultisigIdentity(identity: Buffer, tx?: IDatabaseTransaction): Promise { - return (await this.getMultisigIdentity(identity, tx)) !== undefined - } - async deleteMultisigIdentity(identity: Buffer, tx?: IDatabaseTransaction): Promise { await this.multisigIdentities.del(identity, tx) }