Skip to content

Commit

Permalink
fix the freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Aug 13, 2024
1 parent 4818096 commit 4b7090a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/block/src/constructors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,15 @@ export function createSealedCliqueBlock(
cliqueSigner: Uint8Array,
opts: BlockOptions = {},
): Block {
const sealedCliqueBlock = createBlock(blockData, opts)
const sealedCliqueBlock = createBlock(blockData, { ...opts, ...{ freeze: false } })
;(sealedCliqueBlock.header.extraData as any) = retrieveCliqueBlockExtraData(
sealedCliqueBlock.header,
cliqueSigner,
)

if (opts?.freeze === true) {
// We have to freeze here since we can't freeze the block when constructing it since we are overwriting `extraData`
Object.freeze(sealedCliqueBlock)
}
return sealedCliqueBlock
}

Expand Down
3 changes: 2 additions & 1 deletion packages/blockchain/test/clique.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function getBlock(
// set signer
const cliqueSigner = signer.privateKey

return createSealedCliqueBlock(blockData, cliqueSigner, { common, freeze: false })
return createSealedCliqueBlock(blockData, cliqueSigner, { common })
}

const addNextBlockReorg = async (
Expand Down Expand Up @@ -230,6 +230,7 @@ describe('Clique: Initialization', () => {
)
const block = createSealedCliqueBlock({ header: { number, extraData } }, A.privateKey, {
common: COMMON,
freeze: false,
})
try {
await blockchain.putBlock(block)
Expand Down

0 comments on commit 4b7090a

Please sign in to comment.