@leofcoin/chain 1.7.119 → 1.7.120
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 +11 -10
- package/exports/chain.js +11 -10
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -4801,7 +4801,6 @@ class State extends Contract {
|
|
|
4801
4801
|
let localBlock;
|
|
4802
4802
|
try {
|
|
4803
4803
|
const rawBlock = await globalThis.chainStore.has('lastBlock');
|
|
4804
|
-
console.log({ rawBlock });
|
|
4805
4804
|
if (rawBlock) {
|
|
4806
4805
|
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
|
|
4807
4806
|
blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
|
|
@@ -5033,15 +5032,17 @@ class State extends Contract {
|
|
|
5033
5032
|
}
|
|
5034
5033
|
async #syncChain(lastBlock) {
|
|
5035
5034
|
try {
|
|
5036
|
-
if (this.knownBlocks?.length === Number(lastBlock.index) + 1) {
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
}
|
|
5035
|
+
// if (this.knownBlocks?.length === Number(lastBlock.index) + 1) {
|
|
5036
|
+
// let promises = []
|
|
5037
|
+
// promises = await Promise.allSettled(
|
|
5038
|
+
// this.knownBlocks.map(async (address) => {
|
|
5039
|
+
// const has = await globalThis.peernet.has(address)
|
|
5040
|
+
// return { has, address }
|
|
5041
|
+
// })
|
|
5042
|
+
// )
|
|
5043
|
+
// promises = promises.filter(({ status, value }) => status === 'fulfilled' && !value.has)
|
|
5044
|
+
// await Promise.allSettled(promises.map(({ value }) => this.getAndPutBlock(value.address)))
|
|
5045
|
+
// }
|
|
5045
5046
|
const localBlock = await this.lastBlock;
|
|
5046
5047
|
if (!localBlock || Number(localBlock.index) < Number(lastBlock.index)) {
|
|
5047
5048
|
// TODO: check if valid
|
package/exports/chain.js
CHANGED
|
@@ -928,7 +928,6 @@ class State extends Contract {
|
|
|
928
928
|
let localBlock;
|
|
929
929
|
try {
|
|
930
930
|
const rawBlock = await globalThis.chainStore.has('lastBlock');
|
|
931
|
-
console.log({ rawBlock });
|
|
932
931
|
if (rawBlock) {
|
|
933
932
|
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
|
|
934
933
|
blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
|
|
@@ -1160,15 +1159,17 @@ class State extends Contract {
|
|
|
1160
1159
|
}
|
|
1161
1160
|
async #syncChain(lastBlock) {
|
|
1162
1161
|
try {
|
|
1163
|
-
if (this.knownBlocks?.length === Number(lastBlock.index) + 1) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1162
|
+
// if (this.knownBlocks?.length === Number(lastBlock.index) + 1) {
|
|
1163
|
+
// let promises = []
|
|
1164
|
+
// promises = await Promise.allSettled(
|
|
1165
|
+
// this.knownBlocks.map(async (address) => {
|
|
1166
|
+
// const has = await globalThis.peernet.has(address)
|
|
1167
|
+
// return { has, address }
|
|
1168
|
+
// })
|
|
1169
|
+
// )
|
|
1170
|
+
// promises = promises.filter(({ status, value }) => status === 'fulfilled' && !value.has)
|
|
1171
|
+
// await Promise.allSettled(promises.map(({ value }) => this.getAndPutBlock(value.address)))
|
|
1172
|
+
// }
|
|
1172
1173
|
const localBlock = await this.lastBlock;
|
|
1173
1174
|
if (!localBlock || Number(localBlock.index) < Number(lastBlock.index)) {
|
|
1174
1175
|
// TODO: check if valid
|