Skip to content

Commit

Permalink
Handle creating a sealed block for PoA blocks in vm block builder
Browse files Browse the repository at this point in the history
  • Loading branch information
scorbajio committed Aug 13, 2024
1 parent 6048d8f commit c981daf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/vm/src/buildBlock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
createBlock,
createSealedCliqueBlock,
genRequestsTrieRoot,
genTransactionsTrieRoot,
genWithdrawalsTrieRoot,
Expand Down Expand Up @@ -363,7 +364,16 @@ export class BlockBuilder {
requests,
}

const block = createBlock(blockData, blockOpts)
let block
if (consensusType === ConsensusType.ProofOfAuthority) {
const cs = this.blockOpts.cliqueSigner
if (cs === undefined) {
throw new Error('cliqueSigner must be included if consensus type being used is PoA')
}

Check warning on line 372 in packages/vm/src/buildBlock.ts

View check run for this annotation

Codecov / codecov/patch

packages/vm/src/buildBlock.ts#L371-L372

Added lines #L371 - L372 were not covered by tests
block = createSealedCliqueBlock(blockData, this.blockOpts.cliqueSigner!, this.blockOpts)
} else {
block = createBlock(blockData, blockOpts)
}

if (this.blockOpts.putBlockIntoBlockchain === true) {
await this.vm.blockchain.putBlock(block)
Expand Down

0 comments on commit c981daf

Please sign in to comment.