@@ -2,10 +2,10 @@ import {
2
2
createBlock ,
3
3
createSealedCliqueBlock ,
4
4
genRequestsTrieRoot ,
5
- genTransactionsTrieRoot ,
6
5
genTransactionsSszRoot ,
7
- genWithdrawalsTrieRoot ,
6
+ genTransactionsTrieRoot ,
8
7
genWithdrawalsSszRoot ,
8
+ genWithdrawalsTrieRoot ,
9
9
} from '@ethereumjs/block'
10
10
import { ConsensusType , Hardfork } from '@ethereumjs/common'
11
11
import { RLP } from '@ethereumjs/rlp'
@@ -151,6 +151,16 @@ export class BlockBuilder {
151
151
: genTransactionsTrieRoot ( this . transactions , new Trie ( { common : this . vm . common } ) )
152
152
}
153
153
154
+ public async withdrawalsTrie ( ) {
155
+ if ( this . withdrawals === undefined ) {
156
+ return
157
+ }
158
+
159
+ return this . vm . common . isActivatedEIP ( 6493 )
160
+ ? genWithdrawalsSszRoot ( this . withdrawals )
161
+ : genWithdrawalsTrieRoot ( this . withdrawals , new Trie ( { common : this . vm . common } ) )
162
+ }
163
+
154
164
/**
155
165
* Calculates and returns the logs bloom for the block.
156
166
*/
@@ -326,11 +336,7 @@ export class BlockBuilder {
326
336
await this . processWithdrawals ( )
327
337
328
338
const transactionsTrie = await this . transactionsTrie ( )
329
- const withdrawalsRoot = this . withdrawals
330
- ? this . vm . common . isActivatedEIP ( 6493 )
331
- ? genWithdrawalsSszRoot ( this . withdrawals )
332
- : genWithdrawalsTrieRoot ( this . withdrawals , new Trie ( { common : this . vm . common } ) )
333
- : undefined
339
+ const withdrawalsRoot = await this . withdrawalsTrie ( )
334
340
const receiptTrie = await this . receiptTrie ( )
335
341
const logsBloom = this . logsBloom ( )
336
342
const gasUsed = this . gasUsed
0 commit comments