Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async startInternal(options: InternalOptions): Promise {
logger.info({ name: 'neo_consensus_start' }, 'Consensus started.');
const initialResult = await initializeNewConsensus({
blockchain: this.node.blockchain,
publicKey: options.publicKey,
consensusContext: this.mutableConsensusContext,
});
await AsyncIterableX.from(this.mutableQueue)
.pipe(
scan(async (context: Context, event: Event) => {
let result;
switch (event.type) {
case 'handlePersistBlock':
result = await handlePersistBlock({
blockchain: this.node.blockchain,
publicKey: options.publicKey,
consensusContext: this.mutableConsensusContext,
});
break;
case 'handleConsensusPayload':
result = await handleConsensusPayload({
context,
node: this.node,
privateKey: options.privateKey,
payload: event.payload,