@@ -4,7 +4,7 @@ import util from 'util'
4
4
import * as http from '../http'
5
5
import { P2P } from '@shardus/types'
6
6
import { reversed , validateTypes } from '../utils'
7
- import { config , logger , network } from './Context'
7
+ import { config , crypto , logger , network } from './Context'
8
8
import * as Archivers from './Archivers'
9
9
import * as CycleChain from './CycleChain'
10
10
import * as CycleCreator from './CycleCreator'
@@ -366,11 +366,11 @@ export function digestCycle(cycle: P2P.CycleCreatorTypes.CycleRecord, source: st
366
366
// standby list, but not with the validator and archivers lists
367
367
368
368
const newNodeListHash = NodeList . computeNewNodeListHash ( )
369
- if ( source === 'syncV2' && newNodeListHash !== cycle . nodeListHash ) warn ( `sync:digestCycle source: ${ source } cycle: ${ cycle . counter } patching nodelisthash ${ cycle . nodeListHash } -> ${ newNodeListHash } ` )
369
+ if ( newNodeListHash !== cycle . nodeListHash ) warn ( `sync:digestCycle source: ${ source } cycle: ${ cycle . counter } patching nodelisthash ${ cycle . nodeListHash } -> ${ newNodeListHash } ` )
370
370
cycle . nodeListHash = newNodeListHash
371
371
372
372
const newArchiverListHash = Archivers . computeNewArchiverListHash ( )
373
- if ( source === 'syncV2' && newArchiverListHash !== cycle . archiverListHash ) warn ( `sync:digestCycle source: ${ source } cycle: ${ cycle . counter } patching archiverlisthash ${ cycle . archiverListHash } -> ${ newArchiverListHash } ` )
373
+ if ( newArchiverListHash !== cycle . archiverListHash ) warn ( `sync:digestCycle source: ${ source } cycle: ${ cycle . counter } patching archiverlisthash ${ cycle . archiverListHash } -> ${ newArchiverListHash } ` )
374
374
cycle . archiverListHash = newArchiverListHash
375
375
376
376
// for join v2, also get the standby node list hash
@@ -419,9 +419,16 @@ export function digestCycle(cycle: P2P.CycleCreatorTypes.CycleRecord, source: st
419
419
) } CycleCreator.currentCycle: ${ CycleCreator . currentCycle } `
420
420
)
421
421
422
+
422
423
const changes = parse ( cycle )
424
+
423
425
applyNodeListChange ( changes , true , cycle )
424
426
427
+ if ( logFlags . important_as_error ) {
428
+ const newNodeListHash = crypto . hash ( NodeList . byJoinOrder ) //computeNewNodeListHash not safe due to side effects
429
+ warn ( `sync:digestCycle after applyNodeListChange source: ${ source } cycle: ${ cycle . counter } prev nodelisthash ${ cycle . nodeListHash } next ${ newNodeListHash } ` )
430
+ }
431
+
425
432
// for join v2, also add any new standby nodes to the standy node list
426
433
// and remove any standby nodes that have unjoined.
427
434
if ( config . p2p . useJoinProtocolV2 ) {
@@ -446,7 +453,10 @@ export function digestCycle(cycle: P2P.CycleCreatorTypes.CycleRecord, source: st
446
453
}
447
454
448
455
CycleChain . append ( cycle )
449
- info ( `digestCycle: marker of cycle${ cycle . counter } from ${ source } after digest is ${ CycleChain . computeCycleMarker ( cycle ) } ` )
456
+ const digestedCycleMarker = CycleChain . computeCycleMarker ( cycle )
457
+ info ( `digestCycle: marker of cycle${ cycle . counter } from ${ source } after digest is ${ digestedCycleMarker } ` )
458
+
459
+ /* prettier-ignore */ if ( logFlags . important_as_error ) info ( `digestCycle: cycle: ${ Utils . safeStringify ( cycle ) } ` )
450
460
451
461
// TODO: This seems like a possible location to inetvene if our node
452
462
// is getting far behind on what it thinks the current cycle is
0 commit comments