Skip to content

Commit

Permalink
Merge pull request #159 from DIG-Network/release/v0.0.1-alpha.174
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.174
  • Loading branch information
MichaelTaylor3D authored Oct 26, 2024
2 parents cedb42c + a18aeb4 commit e93e342
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 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.174](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.173...v0.0.1-alpha.174) (2024-10-26)

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


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.173",
"version": "0.0.1-alpha.174",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
7 changes: 4 additions & 3 deletions src/DigNetwork/ContentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import fs from "fs";
import http from "http";
import { URL } from "url";
import { Readable } from "stream";
import { formatHost, DigCache, getOrCreateSSLCerts } from "../utils";
import { formatHost, getOrCreateSSLCerts } from "../utils";
import NodeCache from "node-cache";

const hasRootHashCache = new DigCache({ stdTTL: 86400 });
const wellKnownCache = new DigCache({ stdTTL: 86400 });
const hasRootHashCache = new NodeCache({ stdTTL: 86400 });
const wellKnownCache = new NodeCache({ stdTTL: 86400 });

export class ContentServer {
private ipAddress: string;
Expand Down
7 changes: 4 additions & 3 deletions src/DigNetwork/PropagationServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import { PassThrough } from "stream";
import { promptCredentials } from "../utils/credentialsUtils";
import { STORE_PATH } from "../utils/config";
import { Wallet, DataStore } from "../blockchain";
import { formatHost, DigCache, getOrCreateSSLCerts } from "../utils";
import { formatHost, getOrCreateSSLCerts } from "../utils";
import NodeCache from "node-cache";

// Initialize cache with a TTL of 1 week (604800 seconds)
const storeExistsCache = new DigCache({ stdTTL: 86400 });
const pingUpdatecache = new DigCache({ stdTTL: 86400 });
const storeExistsCache = new NodeCache({ stdTTL: 86400 });
const pingUpdatecache = new NodeCache({ stdTTL: 86400 });

// Helper function to trim long filenames with ellipsis and ensure consistent padding
function formatFilename(filename: string | undefined, maxLength = 30): string {
Expand Down
4 changes: 2 additions & 2 deletions src/blockchain/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import { FileCache } from "../utils/FileCache";
import { DataStoreSerializer } from "./DataStoreSerializer";
import { MAIN_NET_GENISES_CHALLENGE } from "../utils/config";
import { StoreMonitorRegistry } from "./StoreMonitorRegistry";
import { DigCache } from "../utils";
import NodeCache from "node-cache";

// Initialize the cache with a TTL of 180 seconds (3 minutes)
const rootHistoryCache = new DigCache({ stdTTL: 180 });
const rootHistoryCache = new NodeCache({ stdTTL: 180 });

const stat = promisify(fs.stat);
const readdir = promisify(fs.readdir);
Expand Down
10 changes: 5 additions & 5 deletions src/blockchain/FullNodePeer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import net from "net";
import { createSpinner } from "nanospinner";
import { MIN_HEIGHT, MIN_HEIGHT_HEADER_HASH } from "../utils/config";
import { Environment } from "../utils/Environment";
import { DigCache } from "../utils";
import NodeCache from "node-cache";
import Bottleneck from "bottleneck";

const FULLNODE_PORT = 8444;
Expand Down Expand Up @@ -41,12 +41,12 @@ export class FullNodePeer {
private static instance: FullNodePeer | null = null;

// Cooldown cache to exclude faulty peers temporarily
private static cooldownCache = new DigCache({
private static cooldownCache = new NodeCache({
stdTTL: COOLDOWN_DURATION / 1000,
});

// Failed DNS hosts cooldown cache
private static failedDNSCache = new DigCache({ stdTTL: 86400 });
private static failedDNSCache = new NodeCache({ stdTTL: 86400 });

// Peer reliability weights
private static peerWeights: Map<string, number> = new Map();
Expand All @@ -58,10 +58,10 @@ export class FullNodePeer {
private static peerInfos: Map<string, PeerInfo> = new Map();

// Cache for fetched peer IPs
private static peerIPCache = new DigCache({ stdTTL: CACHE_DURATION / 1000 });
private static peerIPCache = new NodeCache({ stdTTL: CACHE_DURATION / 1000 });

// Cache for DNS_HOST resolved IPs with a TTL of 3 days (259200 seconds)
private static dnsCache = new DigCache({
private static dnsCache = new NodeCache({
stdTTL: 259200,
checkperiod: 3600,
});
Expand Down
5 changes: 3 additions & 2 deletions src/blockchain/ServerCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import { Wallet } from "./Wallet";
import { NconfManager } from "../utils/NconfManager";
import { CoinData, ServerCoinData } from "../types";
import { DataStore } from "./DataStore";
import { getPublicHost, DigCache, Environment } from "../utils";
import { getPublicHost, Environment } from "../utils";
import NodeCache from "node-cache";

const serverCoinCollateral = 300_000_000;

// Initialize the cache with a TTL of 300 seconds (5 minutes)
const serverCoinPeersCache = new DigCache({ stdTTL: 300 });
const serverCoinPeersCache = new NodeCache({ stdTTL: 300 });

export class ServerCoin {
private storeId: string;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/PeerRanker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios, { AxiosRequestConfig } from 'axios';
import fs from 'fs';
import https from 'https';
import { DigCache } from './DigCache';
import { getOrCreateSSLCerts } from './ssl';
import { asyncPool } from './promiseUtils';
import NodeCache from "node-cache";

// Cache with TTL of 1 day (86400 seconds)
const peerCache = new DigCache({ stdTTL: 86400 });
const peerCache = new NodeCache({ stdTTL: 86400 });

export interface PeerMetrics {
ip: string;
Expand Down

0 comments on commit e93e342

Please sign in to comment.