1
1
import os from 'os' ;
2
2
import path from 'path' ;
3
- import * as fs from 'fs' ;
4
3
import { app , dialog , BrowserWindow , screen , shell } from 'electron' ;
5
4
import type { Event } from 'electron' ;
6
5
import EventEmitter from 'events' ;
@@ -25,7 +24,6 @@ import {
25
24
RTS_FLAGS ,
26
25
stateDirectoryPath ,
27
26
} from './config' ;
28
-
29
27
import { setupCardanoNode } from './cardano/setup' ;
30
28
import { CardanoNode } from './cardano/CardanoNode' ;
31
29
import { safeExitWithCode } from './utils/safeExitWithCode' ;
@@ -135,50 +133,8 @@ const handleWindowClose = async (event: Event | null | undefined) => {
135
133
await safeExit ( ) ;
136
134
} ;
137
135
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
-
177
136
const onAppReady = async ( ) => {
178
137
setupLogging ( ) ;
179
-
180
- await clearLedger ( ) ;
181
-
182
138
await logUsedVersion (
183
139
environment . version ,
184
140
path . join ( pubLogsFolderPath , 'Daedalus-versions.json' )
0 commit comments