Skip to content

Commit

Permalink
Merge pull request #78 from DIG-Network/release/v0.0.1-alpha.84
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.84
  • Loading branch information
MichaelTaylor3D authored Sep 25, 2024
2 parents be91a02 + 3ce5a64 commit 07d7c27
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.84](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.83...v0.0.1-alpha.84) (2024-09-25)


### Bug Fixes

* download store ([27f8f3f](https://github.com/DIG-Network/dig-chia-sdk/commit/27f8f3f8dd243a4b7b5cc2715fbd3f3fd907c88b))

### [0.0.1-alpha.83](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.82...v0.0.1-alpha.83) (2024-09-25)

### [0.0.1-alpha.82](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.81...v0.0.1-alpha.82) (2024-09-25)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-sdk",
"version": "0.0.1-alpha.83",
"version": "0.0.1-alpha.84",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
21 changes: 12 additions & 9 deletions src/DigNetwork/PropagationServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,16 @@ export class PropagationServer {
task.label,
task.dataPath,
rootHash,
path.join(tempDir, storeId)
tempDir
);
});

// Save the rootHash.dat file to the temporary directory
fs.writeFileSync(
path.join(tempDir, storeId, `${rootHash}.dat`),
datFileContent
);
if (!fs.existsSync(tempDir)) {
fs.mkdirSync(tempDir, { recursive: true });
}

fs.writeFileSync(path.join(tempDir, `${rootHash}.dat`), datFileContent);

// Integrity check for the downloaded files was done during the download
// Here we want to make sure we got all the files or we reject the download session
Expand All @@ -696,17 +697,19 @@ export class PropagationServer {
"data"
);

const downloadPath = path.join(tempDir, storeId, dataPath);
if (!fs.existsSync(path.join(downloadPath, dataPath))) {
if (!fs.existsSync(path.join(tempDir, dataPath))) {
throw new Error(
`Missing file: ${Buffer.from(fileKey, "utf-8")}, aborting session.`
`Missing file: ${Buffer.from(fileKey, "hex")}, aborting session.`
);
}
}

// After all downloads are complete, copy from temp directory to the main directory
const destinationDir = path.join(STORE_PATH, storeId);
fsExtra.copySync(path.join(tempDir, storeId), destinationDir);
fsExtra.copySync(tempDir, destinationDir, {
overwrite: false, // Prevents overwriting existing files
errorOnExist: false, // No error if file already exists
});

// Generate the manifest file in the main directory
const dataStore = DataStore.from(storeId);
Expand Down

0 comments on commit 07d7c27

Please sign in to comment.