hypercore 11.29.0 → 11.30.0

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.
Files changed (2) hide show
  1. package/lib/messages.js +4 -7
  2. package/package.json +2 -2
package/lib/messages.js CHANGED
@@ -1,11 +1,8 @@
1
1
  const c = require('compact-encoding')
2
- const b4a = require('b4a')
3
2
  const { DEFAULT_NAMESPACE } = require('./caps')
4
3
  const { INVALID_OPLOG_VERSION } = require('hypercore-errors')
5
4
  const unslab = require('unslab')
6
5
 
7
- const EMPTY = b4a.alloc(0)
8
-
9
6
  const MANIFEST_PATCH = 0b00000001
10
7
  const MANIFEST_PROLOGUE = 0b00000010
11
8
  const MANIFEST_LINKED = 0b00000100
@@ -403,14 +400,14 @@ const dataUpgrade = {
403
400
  c.uint.preencode(state, u.length)
404
401
  nodeArray.preencode(state, u.nodes)
405
402
  nodeArray.preencode(state, u.additionalNodes)
406
- c.buffer.preencode(state, u.signature)
403
+ c.optionalBuffer.preencode(state, u.signature)
407
404
  },
408
405
  encode(state, u) {
409
406
  c.uint.encode(state, u.start)
410
407
  c.uint.encode(state, u.length)
411
408
  nodeArray.encode(state, u.nodes)
412
409
  nodeArray.encode(state, u.additionalNodes)
413
- c.buffer.encode(state, u.signature)
410
+ c.optionalBuffer.encode(state, u.signature)
414
411
  },
415
412
  decode(state) {
416
413
  return {
@@ -418,7 +415,7 @@ const dataUpgrade = {
418
415
  length: c.uint.decode(state),
419
416
  nodes: nodeArray.decode(state),
420
417
  additionalNodes: nodeArray.decode(state),
421
- signature: c.buffer.decode(state)
418
+ signature: c.optionalBuffer.decode(state)
422
419
  }
423
420
  }
424
421
  }
@@ -454,7 +451,7 @@ const dataBlock = {
454
451
  decode(state) {
455
452
  return {
456
453
  index: c.uint.decode(state),
457
- value: c.buffer.decode(state) || EMPTY,
454
+ value: c.buffer.decode(state),
458
455
  nodes: nodeArray.decode(state)
459
456
  }
460
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.29.0",
3
+ "version": "11.30.0",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@
48
48
  "b4a": "^1.1.0",
49
49
  "bare-events": "^2.2.0",
50
50
  "big-sparse-array": "^1.0.3",
51
- "compact-encoding": "^2.11.0",
51
+ "compact-encoding": "^3.0.0",
52
52
  "fast-fifo": "^1.3.0",
53
53
  "flat-tree": "^1.9.0",
54
54
  "hypercore-crypto": "^3.2.1",