Skip to content

Commit

Permalink
removes unused methods from walletDb (#5641)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hughy authored Nov 13, 2024
1 parent af1527c commit dc683ca
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
10 changes: 0 additions & 10 deletions ironfish/src/wallet/account/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,16 +845,6 @@ export class Account {
}
}

async *getTransactionsOrderedBySequence(
tx?: IDatabaseTransaction,
): AsyncGenerator<Readonly<TransactionValue>> {
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,
Expand Down
48 changes: 0 additions & 48 deletions ironfish/src/wallet/walletdb/walletdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1142,19 +1111,6 @@ export class WalletDB {
}
}

async saveSequenceToTransactionHash(
account: Account,
sequence: number,
transactionHash: Buffer,
tx?: IDatabaseTransaction,
): Promise<void> {
await this.sequenceToTransactionHash.put(
[account.prefix, [sequence, transactionHash]],
null,
tx,
)
}

async deleteSequenceToTransactionHash(
account: Account,
sequence: number,
Expand Down Expand Up @@ -1406,10 +1362,6 @@ export class WalletDB {
return this.multisigIdentities.get(identity, tx)
}

async hasMultisigIdentity(identity: Buffer, tx?: IDatabaseTransaction): Promise<boolean> {
return (await this.getMultisigIdentity(identity, tx)) !== undefined
}

async deleteMultisigIdentity(identity: Buffer, tx?: IDatabaseTransaction): Promise<void> {
await this.multisigIdentities.del(identity, tx)
}
Expand Down

0 comments on commit dc683ca

Please sign in to comment.