Skip to content

Commit

Permalink
Merge pull request #2301 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
hughy authored Oct 5, 2022
2 parents 6769ec1 + d63d516 commit ec57ed3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "0.1.48",
"version": "0.1.49",
"description": "CLI for running and interacting with an Iron Fish node",
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
"main": "build/src/index.js",
Expand Down Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"@aws-sdk/client-s3": "3.127.0",
"@ironfish/rust-nodejs": "0.1.14",
"@ironfish/sdk": "0.0.25",
"@ironfish/sdk": "0.0.26",
"@oclif/core": "1.16.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down
2 changes: 1 addition & 1 deletion ironfish/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ironfish/sdk",
"version": "0.0.25",
"version": "0.0.26",
"description": "SDK for running and interacting with an Iron Fish node",
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
"main": "build/src/index.js",
Expand Down
30 changes: 22 additions & 8 deletions ironfish/src/migrations/data/013-wallet-2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export class Migration013 extends Migration {
let countMissingAccount = Number((await cacheMeta.get('countMissingAccount')) ?? 0)
let countMissingTx = Number((await cacheMeta.get('countMissingTx')) ?? 0)
let countNote = Number((await cacheMeta.get('countNote')) ?? 0)
let countNoteTotal = Number((await cacheMeta.get('countNoteTotal')) ?? 0)

const accounts = await stores.new.accounts.getAllValues(tx)

Expand All @@ -273,9 +274,27 @@ export class Migration013 extends Migration {
for await (const [noteHashHex, nullifierEntry] of stores.old.noteToNullifier.getAllIter(
tx,
)) {
countNoteTotal++

if (countNote % 1000 === 0) {
await cacheMeta.put('countMissingAccount', countMissingAccount)
await cacheMeta.put('countMissingTx', countMissingTx)
await cacheMeta.put('countNote', countNote)
await cacheMeta.put('countNoteTotal', countNoteTotal)

logger.debug(
`Migrated ${countNote} out of ${countNoteTotal} notes: ${speed.rate1s.toFixed(2)}/s`,
)
}

const noteHash = Buffer.from(noteHashHex, 'hex')
const transactionHash = await noteToTransaction.get(noteHash)
Assert.isNotUndefined(transactionHash)

if (!transactionHash) {
countMissingTx++
speed.add(1)
continue
}

const transaction = await transactionsCache.get(transactionHash)

Expand Down Expand Up @@ -368,16 +387,11 @@ export class Migration013 extends Migration {

countNote++
speed.add(1)

if (countNote % 1000 === 0) {
await cacheMeta.put('countMissingAccount', countMissingAccount)
await cacheMeta.put('countMissingTx', countMissingTx)
await cacheMeta.put('countNote', countNote)
logger.debug(`Migrated ${countNote} notes: ${speed.rate1s.toFixed(2)}/s`)
}
}

speed.stop()

logger.debug(`\tSaw ${countNoteTotal}~ notes.`)
logger.debug(`\tMigrated ${countNote}~ notes.`)

if (countMissingAccount) {
Expand Down

0 comments on commit ec57ed3

Please sign in to comment.