Skip to content

Commit

Permalink
ensure WitnessServiceV2.getBlockSchedule() does not crash if election…
Browse files Browse the repository at this point in the history
…Result is null
  • Loading branch information
Geo25rey committed Apr 2, 2024
1 parent 216c3e3 commit 7bd6c54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/new/witness/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ export class WitnessServiceV2 {
const consensusRound = await this.calculateConsensusRound(blockHeight)
const electionResult = await this.self.electionManager.getValidElectionOfblock(blockHeight)
// console.log(electionResult.epoch, this.witnessSchedule.valid_epoch, consensusRound.randomizeHash, this.witnessSchedule.valid_height)
if(this.witnessSchedule.valid_height === consensusRound.pastRoundHeight && electionResult.epoch === this.witnessSchedule.valid_epoch) {
if(this.witnessSchedule.valid_height === consensusRound.pastRoundHeight && electionResult?.epoch === this.witnessSchedule.valid_epoch) {
// console.log('this.witnessSchedule.valid_to', this.witnessSchedule.valid_height, blockHeight, consensusRound)
return this.witnessSchedule.schedule;
}
Expand Down

0 comments on commit 7bd6c54

Please sign in to comment.