@leofcoin/chain 1.7.142 → 1.7.144
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/exports/browser/chain.js +6 -5
- package/exports/chain.js +6 -5
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -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
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
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
|
-
|
|
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
|
@@ -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
|
-
|
|
934
|
-
|
|
935
|
-
|
|
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
|
-
|
|
949
|
-
throw error;
|
|
950
|
+
debug$1('no local known blocks found');
|
|
950
951
|
}
|
|
951
952
|
try {
|
|
952
953
|
if (localBlock.hash && localBlock.hash !== '0x0') {
|