DARKNET: Darkweb Expansion Project & Bitnode (#2139)

This is BN15. It is a really big change; see the PR for all the details.
This commit is contained in:
Michael Ficocelli
2026-02-03 06:40:36 -05:00
committed by GitHub
parent a674633f6c
commit 6073964768
225 changed files with 15010 additions and 526 deletions
+20
View File
@@ -100,3 +100,23 @@ export function assertSaveData(unknownData: unknown): asserts unknownData is Sav
throw new Error("Invalid save data. It's Uint8Array, but its buffer is not ArrayBuffer.");
}
}
/**
* This function only narrows down the type to "number" at compile time, but it guarantees the value is a finite number
* at runtime.
*/
export function assertFiniteNumber(v: unknown): asserts v is number {
if (!Number.isFinite(v)) {
console.error("The value is not a finite number. Value:", v);
const type = getFriendlyType(v);
throw new TypeAssertionError(`The value is not a finite number. Its type is ${type}.`, type);
}
}
export function assertNonNullish<T>(v: unknown): asserts v is NonNullable<T> {
if (v === null || v === undefined) {
console.error("The value is nullish. Value:", v);
const type = getFriendlyType(v);
throw new TypeAssertionError(`The value is nullish. Its type is ${type}.`, type);
}
}