Skip to content

Commit 3881a51

Browse files
committed
TEMP
1 parent 5aeee5b commit 3881a51

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/reputation-miner/ReputationMiner.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ class ReputationMiner {
13561356
filter.fromBlock = blockNumber;
13571357
const events = await this.realProvider.getLogs(filter);
13581358
let localHash = await this.reputationTree.getRootHash();
1359-
let applyLogs = false;
1359+
let applyLogs = true;
13601360

13611361
console.log(`Beginning sync from block ${blockNumber} with ${events.length} cycles`)
13621362

@@ -1512,7 +1512,7 @@ class ReputationMiner {
15121512
}
15131513
const currentStateHash = await this.reputationTree.getRootHash();
15141514
if (currentStateHash !== reputationRootHash) {
1515-
console.log("WARNING: The supplied state failed to be recreated successfully. Are you sure it was saved?");
1515+
console.log(`WARNING: The supplied state ${reputationRootHash} failed to be recreated successfully. Are you sure it was saved?`);
15161516
} else {
15171517
console.log(`Reputation state ${reputationRootHash} was loaded successfully.`);
15181518
}

packages/reputation-miner/ReputationMinerClient.js

+4
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,13 @@ class ReputationMinerClient {
272272

273273
// Get latest state from database if available, otherwise sync to current state on-chain
274274
await this._miner.createDB();
275+
this._adapter.log(`Attempting to load latest on-chain state ${latestConfirmedReputationHash}`);
275276
await this._miner.loadState(latestConfirmedReputationHash);
276277
if (this._miner.nReputations.eq(0)) {
277278
this._adapter.log("Latest state not found - need to sync");
279+
if (startingHash !== undefined) {
280+
await this._miner.loadState(startingHash);
281+
}
278282
await this._miner.sync(startingBlock, true);
279283
}
280284

packages/reputation-miner/bin/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
4545

4646
static attemptCheck(err, attemptNumber){
4747
console.log("Retrying RPC request #", attemptNumber);
48-
if (attemptNumber === 5){
48+
if (attemptNumber === 1000){
4949
return false;
5050
}
5151
return true;
@@ -59,7 +59,7 @@ class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
5959
// method is the method name (e.g. getBalance) and params is an
6060
// object with normalized values passed in, depending on the method
6161
perform(method, params) {
62-
return backoff(() => super.perform(method, params), {retry: RetryProvider.attemptCheck, startingDelay: 1000});
62+
return backoff(() => super.perform(method, params), {retry: RetryProvider.attemptCheck, startingDelay: 1000, numOfAttempts: 1000, timeMultiple: 1});
6363
}
6464
}
6565

0 commit comments

Comments
 (0)