hypercore-storage 1.12.1 → 1.13.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.
package/package.json
CHANGED
|
@@ -252,19 +252,21 @@ const encoding9_6 = c.array(c.fixed32)
|
|
|
252
252
|
const encoding9 = {
|
|
253
253
|
preencode (state, m) {
|
|
254
254
|
c.uint.preencode(state, m.version)
|
|
255
|
-
state.end++ // max flag is
|
|
255
|
+
state.end++ // max flag is 8 so always one byte
|
|
256
256
|
encoding4.preencode(state, m.hash)
|
|
257
257
|
c.uint.preencode(state, m.quorum)
|
|
258
258
|
encoding9_4.preencode(state, m.signers)
|
|
259
259
|
|
|
260
260
|
if (m.prologue) encoding8.preencode(state, m.prologue)
|
|
261
261
|
if (m.linked) encoding9_6.preencode(state, m.linked)
|
|
262
|
+
if (m.userData) c.buffer.preencode(state, m.userData)
|
|
262
263
|
},
|
|
263
264
|
encode (state, m) {
|
|
264
265
|
const flags =
|
|
265
266
|
(m.allowPatch ? 1 : 0) |
|
|
266
267
|
(m.prologue ? 2 : 0) |
|
|
267
|
-
(m.linked ? 4 : 0)
|
|
268
|
+
(m.linked ? 4 : 0) |
|
|
269
|
+
(m.userData ? 8 : 0)
|
|
268
270
|
|
|
269
271
|
c.uint.encode(state, m.version)
|
|
270
272
|
c.uint.encode(state, flags)
|
|
@@ -274,6 +276,7 @@ const encoding9 = {
|
|
|
274
276
|
|
|
275
277
|
if (m.prologue) encoding8.encode(state, m.prologue)
|
|
276
278
|
if (m.linked) encoding9_6.encode(state, m.linked)
|
|
279
|
+
if (m.userData) c.buffer.encode(state, m.userData)
|
|
277
280
|
},
|
|
278
281
|
decode (state) {
|
|
279
282
|
const r0 = c.uint.decode(state)
|
|
@@ -286,7 +289,8 @@ const encoding9 = {
|
|
|
286
289
|
allowPatch: (flags & 1) !== 0,
|
|
287
290
|
signers: encoding9_4.decode(state),
|
|
288
291
|
prologue: (flags & 2) !== 0 ? encoding8.decode(state) : null,
|
|
289
|
-
linked: (flags & 4) !== 0 ? encoding9_6.decode(state) : null
|
|
292
|
+
linked: (flags & 4) !== 0 ? encoding9_6.decode(state) : null,
|
|
293
|
+
userData: (flags & 8) !== 0 ? c.buffer.decode(state) : null
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
296
|
}
|