From dc683ca4c49098c1860c34cce89843cf2f0fdd26 Mon Sep 17 00:00:00 2001 From: Hugh Cunningham <57735705+hughy@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:20:40 -0800 Subject: [PATCH] removes unused methods from walletDb (#5641) * 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 * puts 'loadHeads' back it's used in the 'debug' CLI command --- ironfish/src/wallet/account/account.ts | 10 ----- ironfish/src/wallet/walletdb/walletdb.ts | 48 ------------------------ 2 files changed, 58 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..3543c84942 100644 --- a/ironfish/src/wallet/walletdb/walletdb.ts +++ b/ironfish/src/wallet/walletdb/walletdb.ts @@ -542,19 +542,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 +818,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 +1111,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 +1362,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) }