Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Nov 20, 2022
1 parent 6b5d7df commit c5dd4c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/client/lib/miner/pendingBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class PendingBlock {
throw new Error('cannot get iterator head: blockchain has no getTotalDifficulty function')
}
const td = await vm.blockchain.getTotalDifficulty(parentBlock.hash())
vm._common.setHardforkByBlockNumber(parentBlock.header.number, td)

const builder = await vm.buildBlock({
parentBlock,
Expand All @@ -69,6 +68,7 @@ export class PendingBlock {
withdrawals,
blockOpts: {
putBlockIntoBlockchain: false,
hardforkByTTD: td,
},
})

Expand Down
8 changes: 7 additions & 1 deletion packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ tape('EIP4895 tests', (t) => {
validateBlocks: false,
validateConsensus: false,
genesisState,
hardforkByHeadBlockNumber: true,
})
const genesisBlock = blockchain.genesisBlock
st.equal(
Expand All @@ -204,11 +205,16 @@ tape('EIP4895 tests', (t) => {
const withdrawals = (gethBlockBufferArray[3] as WithdrawalBuffer[]).map((wa) =>
Withdrawal.fromValuesArray(wa)
)
const td = await blockchain.getTotalDifficulty(genesisBlock.hash())

const blockBuilder = await vm.buildBlock({
parentBlock: genesisBlock,
withdrawals,
blockOpts: { calcDifficultyFromHeader: genesisBlock.header, freeze: false },
blockOpts: {
calcDifficultyFromHeader: genesisBlock.header,
freeze: false,
hardforkByTTD: td,
},
})

const block = await blockBuilder.build()
Expand Down

0 comments on commit c5dd4c9

Please sign in to comment.