@leofcoin/chain 1.9.9 → 1.9.10
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 +10 -11
- package/exports/chain.js +10 -11
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { t as toBase58, T as TransactionMessage, C as ContractMessage, R as RawTransactionMessage, B as BlockMessage, L as LastBlockMessage, P as PROTOCOL_VERSION, a as REACHED_ONE_ZERO_ZERO, b as PrevoteMessage, c as PrecommitMessage, d as ProposalMessage, e as BWMessage, S as StateMessage, f as BWRequestMessage } from './constants-BCaq9RBn.js';
|
|
2
|
-
import { log } from 'console';
|
|
3
2
|
|
|
4
3
|
const getTargets = () => Array.from([]);
|
|
5
4
|
const isEnabled = (target) => {
|
|
@@ -4938,7 +4937,7 @@ class State extends Contract {
|
|
|
4938
4937
|
#lastBlockHandler;
|
|
4939
4938
|
#knownBlocksHandler;
|
|
4940
4939
|
async init() {
|
|
4941
|
-
log("State init start");
|
|
4940
|
+
console.log("State init start");
|
|
4942
4941
|
this.jobber = new Jobber(this.resolveTimeout);
|
|
4943
4942
|
await globalThis.peernet.addRequestHandler("lastBlock", this.#lastBlockHandler);
|
|
4944
4943
|
await globalThis.peernet.addRequestHandler("knownBlocks", this.#knownBlocksHandler);
|
|
@@ -4946,13 +4945,13 @@ class State extends Contract {
|
|
|
4946
4945
|
let localBlockHash;
|
|
4947
4946
|
let blockMessage;
|
|
4948
4947
|
let localBlock;
|
|
4949
|
-
log("State init before try-catch");
|
|
4948
|
+
console.log("State init before try-catch");
|
|
4950
4949
|
try {
|
|
4951
4950
|
const rawBlock = await globalThis.chainStore.has("lastBlock");
|
|
4952
|
-
log("State init after has lastBlock check");
|
|
4951
|
+
console.log("State init after has lastBlock check");
|
|
4953
4952
|
if (rawBlock) {
|
|
4954
|
-
log("State init after has lastBlock found");
|
|
4955
|
-
log(rawBlock);
|
|
4953
|
+
console.log("State init after has lastBlock found");
|
|
4954
|
+
console.log(rawBlock);
|
|
4956
4955
|
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get("lastBlock"));
|
|
4957
4956
|
console.log(localBlockHash);
|
|
4958
4957
|
if (localBlockHash !== "0x0") {
|
|
@@ -4961,21 +4960,21 @@ class State extends Contract {
|
|
|
4961
4960
|
blockMessage = await new BlockMessage(blockMessage);
|
|
4962
4961
|
localBlock = { ...blockMessage.decoded, hash: localBlockHash };
|
|
4963
4962
|
}
|
|
4964
|
-
log("State init after localBlock set");
|
|
4963
|
+
console.log("State init after localBlock set");
|
|
4965
4964
|
} else {
|
|
4966
4965
|
localBlock = { index: 0, hash: "0x0", previousHash: "0x0" };
|
|
4967
4966
|
}
|
|
4968
4967
|
} catch {
|
|
4969
4968
|
console.log("e");
|
|
4970
|
-
log("State init middle");
|
|
4969
|
+
console.log("State init middle");
|
|
4971
4970
|
localBlock = { index: 0, hash: "0x0", previousHash: "0x0" };
|
|
4972
4971
|
}
|
|
4973
|
-
log("State init middle");
|
|
4972
|
+
console.log("State init middle");
|
|
4974
4973
|
try {
|
|
4975
|
-
log("fetching known blocks from blockStore");
|
|
4974
|
+
console.log("fetching known blocks from blockStore");
|
|
4976
4975
|
this.knownBlocks = await blockStore.keys();
|
|
4977
4976
|
} catch (error) {
|
|
4978
|
-
|
|
4977
|
+
console.log("no local known blocks found");
|
|
4979
4978
|
}
|
|
4980
4979
|
try {
|
|
4981
4980
|
if (localBlock?.hash && localBlock.hash !== "0x0") {
|
package/exports/chain.js
CHANGED
|
@@ -7,7 +7,6 @@ import semver from 'semver';
|
|
|
7
7
|
import { randombytes } from '@leofcoin/crypto';
|
|
8
8
|
import EasyWorker from '@vandeurenglenn/easy-worker';
|
|
9
9
|
import { ContractDeploymentError, ExecutionError, isResolveError, ResolveError, isExecutionError } from '@leofcoin/errors';
|
|
10
|
-
import { log } from 'console';
|
|
11
10
|
import { P as PROTOCOL_VERSION, R as REACHED_ONE_ZERO_ZERO } from './constants-C83ZCYKa.js';
|
|
12
11
|
import '@leofcoin/networks';
|
|
13
12
|
|
|
@@ -1226,7 +1225,7 @@ class State extends Contract {
|
|
|
1226
1225
|
#lastBlockHandler;
|
|
1227
1226
|
#knownBlocksHandler;
|
|
1228
1227
|
async init() {
|
|
1229
|
-
log("State init start");
|
|
1228
|
+
console.log("State init start");
|
|
1230
1229
|
this.jobber = new Jobber(this.resolveTimeout);
|
|
1231
1230
|
await globalThis.peernet.addRequestHandler("lastBlock", this.#lastBlockHandler);
|
|
1232
1231
|
await globalThis.peernet.addRequestHandler("knownBlocks", this.#knownBlocksHandler);
|
|
@@ -1234,13 +1233,13 @@ class State extends Contract {
|
|
|
1234
1233
|
let localBlockHash;
|
|
1235
1234
|
let blockMessage;
|
|
1236
1235
|
let localBlock;
|
|
1237
|
-
log("State init before try-catch");
|
|
1236
|
+
console.log("State init before try-catch");
|
|
1238
1237
|
try {
|
|
1239
1238
|
const rawBlock = await globalThis.chainStore.has("lastBlock");
|
|
1240
|
-
log("State init after has lastBlock check");
|
|
1239
|
+
console.log("State init after has lastBlock check");
|
|
1241
1240
|
if (rawBlock) {
|
|
1242
|
-
log("State init after has lastBlock found");
|
|
1243
|
-
log(rawBlock);
|
|
1241
|
+
console.log("State init after has lastBlock found");
|
|
1242
|
+
console.log(rawBlock);
|
|
1244
1243
|
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get("lastBlock"));
|
|
1245
1244
|
console.log(localBlockHash);
|
|
1246
1245
|
if (localBlockHash !== "0x0") {
|
|
@@ -1249,21 +1248,21 @@ class State extends Contract {
|
|
|
1249
1248
|
blockMessage = await new BlockMessage(blockMessage);
|
|
1250
1249
|
localBlock = { ...blockMessage.decoded, hash: localBlockHash };
|
|
1251
1250
|
}
|
|
1252
|
-
log("State init after localBlock set");
|
|
1251
|
+
console.log("State init after localBlock set");
|
|
1253
1252
|
} else {
|
|
1254
1253
|
localBlock = { index: 0, hash: "0x0", previousHash: "0x0" };
|
|
1255
1254
|
}
|
|
1256
1255
|
} catch {
|
|
1257
1256
|
console.log("e");
|
|
1258
|
-
log("State init middle");
|
|
1257
|
+
console.log("State init middle");
|
|
1259
1258
|
localBlock = { index: 0, hash: "0x0", previousHash: "0x0" };
|
|
1260
1259
|
}
|
|
1261
|
-
log("State init middle");
|
|
1260
|
+
console.log("State init middle");
|
|
1262
1261
|
try {
|
|
1263
|
-
log("fetching known blocks from blockStore");
|
|
1262
|
+
console.log("fetching known blocks from blockStore");
|
|
1264
1263
|
this.knownBlocks = await blockStore.keys();
|
|
1265
1264
|
} catch (error) {
|
|
1266
|
-
|
|
1265
|
+
console.log("no local known blocks found");
|
|
1267
1266
|
}
|
|
1268
1267
|
try {
|
|
1269
1268
|
if (localBlock?.hash && localBlock.hash !== "0x0") {
|