lisk-sdk
lisk-sdk copied to clipboard
createInitGenesisStateContext & createFinalizeGenesisStateContext have duplicated body
Description
Currently both createInitGenesisStateContext
& createFinalizeGenesisStateContext
have a duplicated code block
return {
eventQueue: childQueue,
getAPIContext: () => new APIContext({ stateStore: this._stateStore, eventQueue: childQueue }),
getStore: (moduleID: Buffer, storePrefix: number) =>
this._stateStore.getStore(moduleID, storePrefix),
header: this._header,
logger: this._logger,
assets: this._assets,
setNextValidators: (
precommitThreshold: bigint,
certificateThreshold: bigint,
validators: Validator[],
) => {
if (this._nextValidators) {
throw new Error('Next validators can be set only once');
}
this._nextValidators = {
precommitThreshold,
certificateThreshold,
validators: [...validators],
};
},
};
Motivation
Both methods should be updated to avoid duplication
Additional Information
framework/src/state_machine/genesis_block_context.ts