Skip to content

Commit

Permalink
Merge pull request #118 from DIG-Network/release/v0.0.1-alpha.129
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.129
  • Loading branch information
MichaelTaylor3D authored Oct 4, 2024
2 parents 1554afd + 827aeab commit ebec380
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 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.129](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.128...v0.0.1-alpha.129) (2024-10-04)


### Features

* add ping network on update ([c7ebc6f](https://github.com/DIG-Network/dig-chia-sdk/commit/c7ebc6fc4ff04c880d0363d9079bca09256d789a))

### [0.0.1-alpha.128](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.127...v0.0.1-alpha.128) (2024-10-04)


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.128",
"version": "0.0.1-alpha.129",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/DigNetwork/DigNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ export class DigNetwork {
}
}
}

DigNetwork.pingNetworkOfUpdate(this.dataStore.StoreId, rootInfo.root_hash);
}

console.log("Syncing store complete.");
Expand Down
33 changes: 33 additions & 0 deletions src/DigNetwork/PropagationServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,39 @@ export class PropagationServer {
});
}

/**
* Ping the current peer about an update to the store, passing rootHash.
* @param rootHash - The root hash for the store update.
*/
async getMyPublicIp(rootHash: string): Promise<void> {
try {
const httpsAgent = this.createHttpsAgent();
const url = `https://${formatHost(this.ipAddress)}:${
PropagationServer.port
}/peer`;

const config: AxiosRequestConfig = {
httpsAgent,
headers: {
"Content-Type": "application/json",
},
};

try {
const response = await axios.get(url, config);
console.log(green(`✔ Successfully pinged peer: ${this.ipAddress}`));

return response.data;
} catch (error: any) {
console.error(red(`✖ Failed to ping peer: ${this.ipAddress}`));
console.error(red(error.message));
throw error;
}
} catch (error: any) {
console.error(red(error.message));
}
}

/**
* Ping the current peer about an update to the store, passing rootHash.
* @param rootHash - The root hash for the store update.
Expand Down

0 comments on commit ebec380

Please sign in to comment.