@@ -62,7 +62,7 @@ class ReputationMiner {
62
62
this . minerAddress = this . realWallet . address ;
63
63
// TODO: Check that this wallet can stake?
64
64
this . minerAddress = this . realWallet . address ;
65
- console . log ( " Transactions will be signed from " , this . realWallet . address ) ;
65
+ console . log ( ` Transactions will be signed from ${ this . realWallet . address } ` ) ;
66
66
}
67
67
}
68
68
@@ -1254,6 +1254,8 @@ class ReputationMiner {
1254
1254
if ( ! blockNumber ) {
1255
1255
throw new Error ( "Block number not supplied to sync" ) ;
1256
1256
}
1257
+ console . log ( `Beginning sync from block ${ blockNumber } ` )
1258
+
1257
1259
// Get the events
1258
1260
const filter = this . colonyNetwork . filters . ReputationMiningCycleComplete ( null , null ) ;
1259
1261
filter . fromBlock = blockNumber ;
@@ -1263,7 +1265,7 @@ class ReputationMiner {
1263
1265
1264
1266
// Run through events backwards find the most recent one that we know...
1265
1267
let syncFromIndex = 0 ;
1266
- for ( let i = events . length - 1 ; i >= 0 ; i -= 1 ) {
1268
+ for ( let i = events . length - 1 ; i >= 0 ; i -= 1 ) {
1267
1269
const event = events [ i ] ;
1268
1270
const hash = event . data . slice ( 0 , 66 ) ;
1269
1271
const nLeaves = ethers . BigNumber . from ( `0x${ event . data . slice ( 66 , 130 ) } ` ) ;
@@ -1286,8 +1288,10 @@ class ReputationMiner {
1286
1288
}
1287
1289
1288
1290
for ( let i = syncFromIndex ; i < events . length ; i += 1 ) {
1289
- console . log ( `${ new Date ( ) . toLocaleTimeString ( ) } : Syncing mining cycle ${ i + 1 } of ${ events . length } ...` )
1290
1291
const event = events [ i ] ;
1292
+ console . log (
1293
+ `${ new Date ( ) . toLocaleTimeString ( ) } : Syncing mining cycle ${ i + 1 } of ${ events . length } , from block ${ event . blockNumber } and localHash ${ localHash } `
1294
+ ) ;
1291
1295
if ( i === 0 ) {
1292
1296
// If we are syncing from the very start of the reputation history, the block
1293
1297
// before the very first 'ReputationMiningCycleComplete' does not have an
@@ -1327,7 +1331,8 @@ class ReputationMiner {
1327
1331
localHash = await this . reputationTree . getRootHash ( ) ;
1328
1332
const localNLeaves = await this . nReputations ;
1329
1333
if ( localHash !== currentHash || ! currentNLeaves . eq ( localNLeaves ) ) {
1330
- console . log ( "ERROR: Sync failed and did not recover" ) ;
1334
+ console . log ( `Error: Sync failed and did not recover, final hash does not match ${ currentHash } .` ) ;
1335
+ console . log ( "If the miner has been syncing for a while, try restarting, as the mining cycle may have advanced." ) ;
1331
1336
} else {
1332
1337
console . log ( "Sync successful, even if there were warnings above" ) ;
1333
1338
}
@@ -1401,6 +1406,8 @@ class ReputationMiner {
1401
1406
const currentStateHash = await this . reputationTree . getRootHash ( ) ;
1402
1407
if ( currentStateHash !== reputationRootHash ) {
1403
1408
console . log ( "WARNING: The supplied state failed to be recreated successfully. Are you sure it was saved?" ) ;
1409
+ } else {
1410
+ console . log ( `Reputation state ${ reputationRootHash } was loaded successfully.` ) ;
1404
1411
}
1405
1412
}
1406
1413
0 commit comments