Skip to content

Commit

Permalink
clears walletDb in 'mainnet' command (#3805)
Browse files Browse the repository at this point in the history
adds changes from #3797 into 'mainnet' command.

clears old chain data from the walletdb that cannot be migrated or deleted by
key following changes from network reset.
  • Loading branch information
hughy authored and NullSoldier committed Apr 20, 2023
1 parent 1d34f87 commit 72d2220
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ironfish-cli/src/commands/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ export default class Mainnet extends IronfishCommand {
this.sdk.internal.clear('telemetryNodeId')
await this.sdk.internal.save()

// Reset walletDb stores containing chain data
const node = await this.sdk.node()
const walletDb = node.wallet.walletDb

await walletDb.db.open()

for (const store of walletDb.cacheStores) {
await store.clear()
}

CliUx.ux.action.stop('Data migrated successfully.')
}
}

0 comments on commit 72d2220

Please sign in to comment.