Skip to content

Commit

Permalink
Merge pull request #39 from DIG-Network/release/v0.0.1-alpha.42
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.42
  • Loading branch information
MichaelTaylor3D authored Sep 19, 2024
2 parents cc80472 + 6616378 commit cd35f6d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.42](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.41...v0.0.1-alpha.42) (2024-09-19)

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


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.41",
"version": "0.0.1-alpha.42",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
9 changes: 9 additions & 0 deletions src/DigNetwork/DigNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ export class DigNetwork {
rootInfo.root_hash
);

if (fs.existsSync(`${this.storeDir}/${rootInfo.root_hash}.dat`)) {
console.log(
`Root hash ${rootInfo.root_hash} already exists locally. Skipping download.`
);
continue; // Skip to the next rootInfo
}

if (!peerIp) {
console.error(
`No peer found with root hash ${rootInfo.root_hash}. Skipping download.`
Expand All @@ -253,6 +260,8 @@ export class DigNetwork {
`${rootInfo.root_hash}.dat`
);

fs.writeFileSync(`${this.storeDir}/${rootInfo.root_hash}.dat`, rootResponse);

const root = JSON.parse(rootResponse);

if (!skipData) {
Expand Down

0 comments on commit cd35f6d

Please sign in to comment.