@leofcoin/chain 1.7.141 → 1.7.143

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.
@@ -4132,7 +4132,7 @@ const isResolveError = (error) => error.name === 'ResolveError';
4132
4132
  const isExecutionError = (error) => error.name === 'ExecutionError';
4133
4133
 
4134
4134
  // import State from './state'
4135
- const debug$2 = globalThis.createDebugger('leofcoin/machine');
4135
+ const debug$2 = createDebugger('leofcoin/machine');
4136
4136
  class Machine {
4137
4137
  constructor(blocks) {
4138
4138
  this.states = {
@@ -4629,7 +4629,7 @@ class Jobber {
4629
4629
  }
4630
4630
  }
4631
4631
 
4632
- const debug$1 = globalThis.createDebugger('leofcoin/state');
4632
+ const debug$1 = createDebugger('leofcoin/state');
4633
4633
  class State extends Contract {
4634
4634
  #resolveErrored;
4635
4635
  #lastResolvedTime;
@@ -4790,9 +4790,11 @@ class State extends Contract {
4790
4790
  const rawBlock = await globalThis.chainStore.has('lastBlock');
4791
4791
  if (rawBlock) {
4792
4792
  localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
4793
- blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
4794
- blockMessage = await new BlockMessage(blockMessage);
4795
- localBlock = { ...blockMessage.decoded, hash: localBlockHash };
4793
+ if (localBlockHash !== '0x0') {
4794
+ blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
4795
+ blockMessage = await new BlockMessage(blockMessage);
4796
+ localBlock = { ...blockMessage.decoded, hash: localBlockHash };
4797
+ }
4796
4798
  }
4797
4799
  else {
4798
4800
  localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
@@ -4805,8 +4807,7 @@ class State extends Contract {
4805
4807
  this.knownBlocks = await blockStore.keys();
4806
4808
  }
4807
4809
  catch (error) {
4808
- console.error(error);
4809
- throw error;
4810
+ debug$1('no local known blocks found');
4810
4811
  }
4811
4812
  try {
4812
4813
  if (localBlock.hash && localBlock.hash !== '0x0') {
package/exports/chain.js CHANGED
@@ -272,7 +272,7 @@ class Contract extends Transaction {
272
272
  }
273
273
 
274
274
  // import State from './state'
275
- const debug$2 = globalThis.createDebugger('leofcoin/machine');
275
+ const debug$2 = createDebugger('leofcoin/machine');
276
276
  class Machine {
277
277
  constructor(blocks) {
278
278
  this.states = {
@@ -769,7 +769,7 @@ class Jobber {
769
769
  }
770
770
  }
771
771
 
772
- const debug$1 = globalThis.createDebugger('leofcoin/state');
772
+ const debug$1 = createDebugger('leofcoin/state');
773
773
  class State extends Contract {
774
774
  #resolveErrored;
775
775
  #lastResolvedTime;
@@ -930,9 +930,11 @@ class State extends Contract {
930
930
  const rawBlock = await globalThis.chainStore.has('lastBlock');
931
931
  if (rawBlock) {
932
932
  localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
933
- blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
934
- blockMessage = await new BlockMessage(blockMessage);
935
- localBlock = { ...blockMessage.decoded, hash: localBlockHash };
933
+ if (localBlockHash !== '0x0') {
934
+ blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
935
+ blockMessage = await new BlockMessage(blockMessage);
936
+ localBlock = { ...blockMessage.decoded, hash: localBlockHash };
937
+ }
936
938
  }
937
939
  else {
938
940
  localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
@@ -945,8 +947,7 @@ class State extends Contract {
945
947
  this.knownBlocks = await blockStore.keys();
946
948
  }
947
949
  catch (error) {
948
- console.error(error);
949
- throw error;
950
+ debug$1('no local known blocks found');
950
951
  }
951
952
  try {
952
953
  if (localBlock.hash && localBlock.hash !== '0x0') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.141",
3
+ "version": "1.7.143",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {