Skip to content

Commit 9131b80

Browse files
axiccdetrio
authored andcommitted
Support creating block with transactions
1 parent e2c241f commit 9131b80

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/util.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const rlp = utils.rlp
55
const Account = require('ethereumjs-account')
66
const Transaction = require('ethereumjs-tx')
77
const Block = require('ethereumjs-block')
8-
const Header = require('ethereumjs-block/header.js')
98

109
exports.dumpState = function (state, cb) {
1110
var rs = state.createReadStream()
@@ -251,7 +250,7 @@ exports.toCodeHash = function (hexCode) {
251250
}
252251

253252
exports.makeBlockHeader = function (data) {
254-
var header = new Header()
253+
var header = {}
255254
header.timestamp = format(data.currentTimestamp)
256255
header.gasLimit = format(data.currentGasLimit)
257256
if (data.previousHash) {
@@ -266,13 +265,15 @@ exports.makeBlockHeader = function (data) {
266265
/**
267266
* makeBlockFromEnv - helper to create a block from the env object in tests repo
268267
* @param {Object} env object from tests repo
268+
* @param {Object} transactions transactions for the block
269269
* @return {Object} the block
270270
*/
271-
exports.makeBlockFromEnv = function (env) {
272-
var block = new Block()
273-
block.header = exports.makeBlockHeader(env)
274-
275-
return block
271+
exports.makeBlockFromEnv = function (env, transactions) {
272+
return new Block({
273+
header: exports.makeBlockHeader(env),
274+
transactions: transactions || {},
275+
uncleHeaders: []
276+
})
276277
}
277278

278279
/**

0 commit comments

Comments
 (0)