Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old migration code #4954

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { generateKeyFromPrivateKey, PUBLIC_ADDRESS_LENGTH } from '@ironfish/rust-nodejs'
import { PUBLIC_ADDRESS_LENGTH } from '@ironfish/rust-nodejs'
import bufio from 'bufio'
import {
IDatabase,
IDatabaseEncoding,
IDatabaseStore,
IDatabaseTransaction,
StringEncoding,
} from '../../../storage'
import { Account } from '../../../wallet'
import { MigrationContext } from '../../migration'
import { IDatabase, IDatabaseEncoding, IDatabaseStore, StringEncoding } from '../../../storage'

const KEY_LENGTH = 32

Expand Down Expand Up @@ -83,29 +75,3 @@ export function GetOldStores(db: IDatabase): {

return { accounts }
}

export async function GetOldAccounts(
context: MigrationContext,
db: IDatabase,
tx?: IDatabaseTransaction,
): Promise<Account[]> {
const accounts = []
const oldStores = GetOldStores(db)

for await (const account of oldStores.accounts.getAllValuesIter(tx)) {
const key = generateKeyFromPrivateKey(account.spendingKey)

accounts.push(
new Account({
...account,
version: 1,
proofAuthorizingKey: null,
viewKey: key.viewKey,
createdAt: null,
walletDb: context.wallet.walletDb,
}),
)
}

return accounts
}