@ethersphere/bee-js 9.8.0 → 9.8.1

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.
@@ -83,9 +83,12 @@ class Fork {
83
83
  const type = cafe_utility_1.Binary.uint8ToNumber(reader.read(1));
84
84
  const prefixLength = cafe_utility_1.Binary.uint8ToNumber(reader.read(1));
85
85
  const prefix = reader.read(prefixLength);
86
- reader.read(30 - prefixLength);
86
+ if (prefixLength < 30) {
87
+ reader.read(30 - prefixLength);
88
+ }
87
89
  const selfAddress = reader.read(addressLength);
88
90
  debug('unmarshalling fork', {
91
+ type,
89
92
  prefixLength,
90
93
  prefix: DECODER.decode(prefix),
91
94
  addressLength,
@@ -225,12 +228,12 @@ class MantarayNode {
225
228
  throw new Error('MantarayNode#unmarshal invalid version hash');
226
229
  }
227
230
  const targetAddressLength = cafe_utility_1.Binary.uint8ToNumber(reader.read(1));
228
- const targetAddress = targetAddressLength === 0 ? __1.NULL_ADDRESS : reader.read(targetAddressLength);
231
+ const targetAddress = targetAddressLength ? reader.read(targetAddressLength) : __1.NULL_ADDRESS;
229
232
  const node = new MantarayNode({ selfAddress, targetAddress, obfuscationKey });
230
233
  const forkBitmap = reader.read(32);
231
234
  for (let i = 0; i < 256; i++) {
232
235
  if (cafe_utility_1.Binary.getBit(forkBitmap, i, 'LE')) {
233
- const newFork = Fork.unmarshal(reader, targetAddressLength);
236
+ const newFork = Fork.unmarshal(reader, selfAddress.length);
234
237
  node.forks.set(i, newFork);
235
238
  newFork.node.parent = node;
236
239
  }