@hive-p2p/server 1.0.88 → 1.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/crypto-codex.mjs +4 -2
- package/package.json +1 -1
package/core/crypto-codex.mjs
CHANGED
|
@@ -223,9 +223,10 @@ export class CryptoCodex {
|
|
|
223
223
|
readGossipMessage(serialized) {
|
|
224
224
|
if (this.verbose > 3) console.log(`%creadGossipMessage ${serialized.byteLength} bytes`, LOG_CSS.CRYPTO_CODEX);
|
|
225
225
|
if (this.verbose > 4) console.log(`%c${serialized}`, LOG_CSS.CRYPTO_CODEX);
|
|
226
|
+
let topic;
|
|
226
227
|
try { // 1, 1, 1, 8, 4, 32, X, 64, 1
|
|
227
228
|
const { marker, dataCode, neighLength, timestamp, dataLength, pubkey, associatedId } = this.readBufferHeader(serialized);
|
|
228
|
-
|
|
229
|
+
topic = GOSSIP.MARKERS_BYTES[marker];
|
|
229
230
|
if (topic === undefined) throw new Error(`Failed to deserialize gossip message: unknown marker byte ${d[0]}.`);
|
|
230
231
|
const NDBL = neighLength + dataLength;
|
|
231
232
|
const neighbors = this.#bytesToIds(serialized.slice(47, 47 + neighLength));
|
|
@@ -243,9 +244,10 @@ export class CryptoCodex {
|
|
|
243
244
|
readUnicastMessage(serialized, peerStore) {
|
|
244
245
|
if (this.verbose > 3) console.log(`%creadUnicastMessage ${serialized.byteLength} bytes`, LOG_CSS.CRYPTO_CODEX);
|
|
245
246
|
if (this.verbose > 4) console.log(`%c${serialized}`, LOG_CSS.CRYPTO_CODEX);
|
|
247
|
+
let type;
|
|
246
248
|
try { // 1, 1, 1, 8, 4, 32, X, 1, X, 64
|
|
247
249
|
const { marker, dataCode, neighLength, timestamp, dataLength, pubkey } = this.readBufferHeader(serialized, false);
|
|
248
|
-
|
|
250
|
+
type = UNICAST.MARKERS_BYTES[marker];
|
|
249
251
|
if (type === undefined) throw new Error(`Failed to deserialize unicast message: unknown marker byte ${d[0]}.`);
|
|
250
252
|
const NDBL = neighLength + dataLength;
|
|
251
253
|
const neighbors = this.#bytesToIds(serialized.slice(47, 47 + neighLength));
|