Skip to content

Commit

Permalink
fix: manifest file gen
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 22, 2024
1 parent 98d96ae commit cf406aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/DigNetwork/PropagationServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ export class PropagationServer {
await propagationServer.downloadFile(dataPath);
}

const dataStore = new DataStore(storeId);
await dataStore.generateManifestFile();

console.log(green(`✔ All files have been downloaded to ${storeId}.`));
}
}
7 changes: 5 additions & 2 deletions src/blockchain/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,14 @@ export class DataStore {

// Generates a fresh manifest file based on the current root history
// and what is currently on disk
public async generateManifestFile(): Promise<void> {
public async generateManifestFile(folderPath?: string): Promise<void> {
if (!folderPath) {
folderPath = path.join(STORE_PATH, this.storeId, "data");
}
const rootHistory = await this.getRootHistory();
// Need this for the dataintegrity tree to work properly
fs.writeFileSync(
path.join(STORE_PATH, this.storeId, "manifest.dat"),
path.join(folderPath, "manifest.dat"),
rootHistory
.filter((root) => root.synced)
.map((root) => root.root_hash)
Expand Down

0 comments on commit cf406aa

Please sign in to comment.