Skip to content

Commit 1e55c28

Browse files
committed
Revert "[LW-12241] Update index.ts to cater for the cleardown of ledger state if not alr… (#3276)"
This reverts commit b54a34e. The ledger team say it’s unnecessary.
1 parent b54a34e commit 1e55c28

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

source/main/index.ts

-44
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os from 'os';
22
import path from 'path';
3-
import * as fs from 'fs';
43
import { app, dialog, BrowserWindow, screen, shell } from 'electron';
54
import type { Event } from 'electron';
65
import EventEmitter from 'events';
@@ -25,7 +24,6 @@ import {
2524
RTS_FLAGS,
2625
stateDirectoryPath,
2726
} from './config';
28-
2927
import { setupCardanoNode } from './cardano/setup';
3028
import { CardanoNode } from './cardano/CardanoNode';
3129
import { safeExitWithCode } from './utils/safeExitWithCode';
@@ -135,50 +133,8 @@ const handleWindowClose = async (event: Event | null | undefined) => {
135133
await safeExit();
136134
};
137135

138-
const clearLedger = async () => {
139-
const flagFileShortName = 'has_upgraded_to_pv_10';
140-
const chainLedgerDir = 'chain/ledger';
141-
142-
const flagFileLongName = path.join(
143-
launcherConfig.stateDir,
144-
flagFileShortName
145-
);
146-
147-
// Check if the flag file exists
148-
if (fs.existsSync(flagFileLongName)) {
149-
logger.info(`${flagFileLongName} found. NoHskpg.`);
150-
} else {
151-
try {
152-
const chainLedgerLongName = path.join(
153-
launcherConfig.stateDir,
154-
chainLedgerDir
155-
);
156-
157-
const files = fs.readdirSync(chainLedgerLongName);
158-
159-
for (const file of files) {
160-
// DelIterator
161-
const filePath = path.join(chainLedgerLongName, file);
162-
if (fs.lstatSync(filePath).isFile()) {
163-
// ?it's a file
164-
fs.unlinkSync(filePath);
165-
logger.info(`HskpgDone: ${filePath}`);
166-
}
167-
}
168-
169-
// Create v10-upgraded completed marker
170-
fs.writeFileSync(flagFileLongName, 'HskpgNwFlag');
171-
} catch (err) {
172-
logger.error(`Error removing files: ${err}`);
173-
}
174-
}
175-
};
176-
177136
const onAppReady = async () => {
178137
setupLogging();
179-
180-
await clearLedger();
181-
182138
await logUsedVersion(
183139
environment.version,
184140
path.join(pubLogsFolderPath, 'Daedalus-versions.json')

0 commit comments

Comments
 (0)