@leofcoin/chain 1.4.55 → 1.4.57
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 -3
- package/exports/chain.js +6 -3
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -7884,6 +7884,7 @@ globalThis.BigNumber = BigNumber;
|
|
|
7884
7884
|
// check if browser or local
|
|
7885
7885
|
class Chain extends Contract {
|
|
7886
7886
|
version;
|
|
7887
|
+
#resolveErrored;
|
|
7887
7888
|
#state;
|
|
7888
7889
|
#lastResolved;
|
|
7889
7890
|
#slotTime = 10000;
|
|
@@ -8236,12 +8237,13 @@ class Chain extends Contract {
|
|
|
8236
8237
|
if (!peer.version || peer.version !== this.version)
|
|
8237
8238
|
return;
|
|
8238
8239
|
const lastBlock = await this.#makeRequest(peer, 'lastBlock');
|
|
8239
|
-
if (lastBlock && lastBlock.index > this.#lastBlock?.index) {
|
|
8240
|
+
if (this.#resolveErrored || lastBlock && lastBlock.index > this.#lastBlock?.index) {
|
|
8240
8241
|
// this.#knownBlocks = await this.#makeRequest(peer, 'knownBlocks')
|
|
8241
8242
|
console.log(lastBlock);
|
|
8243
|
+
this.#resolveErrored = false;
|
|
8242
8244
|
if (lastBlock)
|
|
8243
8245
|
await this.#syncChain(lastBlock);
|
|
8244
|
-
if (await this.hasTransactionToHandle())
|
|
8246
|
+
if (await this.hasTransactionToHandle() && !this.#resolveErrored && this.#participating)
|
|
8245
8247
|
this.#runEpoch();
|
|
8246
8248
|
}
|
|
8247
8249
|
}
|
|
@@ -8300,6 +8302,7 @@ class Chain extends Contract {
|
|
|
8300
8302
|
}
|
|
8301
8303
|
}
|
|
8302
8304
|
catch (error) {
|
|
8305
|
+
this.#resolveErrored = true;
|
|
8303
8306
|
console.error(error);
|
|
8304
8307
|
}
|
|
8305
8308
|
}
|
|
@@ -8431,7 +8434,7 @@ class Chain extends Contract {
|
|
|
8431
8434
|
const transaction = await signTransaction(rawTransaction, globalThis.peernet.identity);
|
|
8432
8435
|
await this.sendTransaction(transaction);
|
|
8433
8436
|
}
|
|
8434
|
-
if (await this.hasTransactionToHandle() && !this.#runningEpoch)
|
|
8437
|
+
if (await this.hasTransactionToHandle() && !this.#runningEpoch && this.#participating)
|
|
8435
8438
|
await this.#runEpoch();
|
|
8436
8439
|
}
|
|
8437
8440
|
// todo filter tx that need to wait on prev nonce
|
package/exports/chain.js
CHANGED
|
@@ -470,6 +470,7 @@ globalThis.BigNumber = BigNumber;
|
|
|
470
470
|
// check if browser or local
|
|
471
471
|
class Chain extends Contract {
|
|
472
472
|
version;
|
|
473
|
+
#resolveErrored;
|
|
473
474
|
#state;
|
|
474
475
|
#lastResolved;
|
|
475
476
|
#slotTime = 10000;
|
|
@@ -822,12 +823,13 @@ class Chain extends Contract {
|
|
|
822
823
|
if (!peer.version || peer.version !== this.version)
|
|
823
824
|
return;
|
|
824
825
|
const lastBlock = await this.#makeRequest(peer, 'lastBlock');
|
|
825
|
-
if (lastBlock && lastBlock.index > this.#lastBlock?.index) {
|
|
826
|
+
if (this.#resolveErrored || lastBlock && lastBlock.index > this.#lastBlock?.index) {
|
|
826
827
|
// this.#knownBlocks = await this.#makeRequest(peer, 'knownBlocks')
|
|
827
828
|
console.log(lastBlock);
|
|
829
|
+
this.#resolveErrored = false;
|
|
828
830
|
if (lastBlock)
|
|
829
831
|
await this.#syncChain(lastBlock);
|
|
830
|
-
if (await this.hasTransactionToHandle())
|
|
832
|
+
if (await this.hasTransactionToHandle() && !this.#resolveErrored && this.#participating)
|
|
831
833
|
this.#runEpoch();
|
|
832
834
|
}
|
|
833
835
|
}
|
|
@@ -886,6 +888,7 @@ class Chain extends Contract {
|
|
|
886
888
|
}
|
|
887
889
|
}
|
|
888
890
|
catch (error) {
|
|
891
|
+
this.#resolveErrored = true;
|
|
889
892
|
console.error(error);
|
|
890
893
|
}
|
|
891
894
|
}
|
|
@@ -1017,7 +1020,7 @@ class Chain extends Contract {
|
|
|
1017
1020
|
const transaction = await signTransaction(rawTransaction, globalThis.peernet.identity);
|
|
1018
1021
|
await this.sendTransaction(transaction);
|
|
1019
1022
|
}
|
|
1020
|
-
if (await this.hasTransactionToHandle() && !this.#runningEpoch)
|
|
1023
|
+
if (await this.hasTransactionToHandle() && !this.#runningEpoch && this.#participating)
|
|
1021
1024
|
await this.#runEpoch();
|
|
1022
1025
|
}
|
|
1023
1026
|
// todo filter tx that need to wait on prev nonce
|