Skip to content

Commit

Permalink
Merge pull request #34 from DIG-Network/release/v0.0.1-alpha.36
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.36
  • Loading branch information
MichaelTaylor3D authored Sep 19, 2024
2 parents bbfae9f + 4d17d44 commit 0b79d8f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 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.36](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.35...v0.0.1-alpha.36) (2024-09-19)


### Bug Fixes

* findPeerWithStoreKey ([dc4238e](https://github.com/DIG-Network/dig-chia-sdk/commit/dc4238e69d4260d9c24a6cf92ee9a6874b2cc733))

### [0.0.1-alpha.35](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.34...v0.0.1-alpha.35) (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.35",
"version": "0.0.1-alpha.36",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
26 changes: 10 additions & 16 deletions src/DigNetwork/DigNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,23 @@ export class DigNetwork {

console.log(peerIp, storeResponse.headers);

if (
storeResponse.success &&
storeResponse.headers?.["x-has-rootHash"] === "true"
) {
if (!key) return peerIp;
if (storeResponse.headers?.["x-has-roothash"] === "true") {
console.log(
`Found Peer at ${peerIp} for storeId: ${storeId}, root hash ${rootHash}`
);

if (!key) {
return peerIp;
}

const keyResponse = await digPeer.contentServer.headKey(key);
if (
keyResponse.success &&
keyResponse.headers?.["x-key-exists"] === "true"
) {
if (keyResponse.headers?.["x-key-exists"] === "true") {
return peerIp;
}
}

peerBlackList.push(peerIp);
} catch (error) {
console.error(
"Error while sampling the epoch or contacting peer:",
error
);
break;
}
} catch {}
}

return null;
Expand Down

0 comments on commit 0b79d8f

Please sign in to comment.