|
3 | 3 | import { BaseTrie as Trie } from 'merkle-patricia-tree'
|
4 | 4 | import { BN, rlp, keccak256, KECCAK256_RLP } from 'ethereumjs-util'
|
5 | 5 | import Common from '@ethereumjs/common'
|
6 |
| -import { Transaction, TxOptions } from '@ethereumjs/tx' |
| 6 | +import { TransactionFactory, Transaction, TxOptions } from '@ethereumjs/tx' |
7 | 7 | import { BlockHeader } from './header'
|
8 | 8 | import { BlockData, BlockOptions, JsonBlock, BlockBuffer, Blockchain } from './types'
|
9 | 9 |
|
@@ -31,7 +31,7 @@ export class Block {
|
31 | 31 | // parse transactions
|
32 | 32 | const transactions = []
|
33 | 33 | for (const txData of txsData || []) {
|
34 |
| - const tx = Transaction.fromTxData(txData, { |
| 34 | + const tx = TransactionFactory.fromTxData(txData, { |
35 | 35 | ...opts,
|
36 | 36 | // Use header common in case of hardforkByBlockNumber being activated
|
37 | 37 | common: header._common,
|
@@ -91,7 +91,7 @@ export class Block {
|
91 | 91 | const transactions = []
|
92 | 92 | for (const txData of txsData || []) {
|
93 | 93 | transactions.push(
|
94 |
| - Transaction.fromValuesArray(txData, { |
| 94 | + TransactionFactory.fromBlockBodyData(txData, { |
95 | 95 | ...opts,
|
96 | 96 | // Use header common in case of hardforkByBlockNumber being activated
|
97 | 97 | common: header._common,
|
@@ -154,7 +154,7 @@ export class Block {
|
154 | 154 | raw(): BlockBuffer {
|
155 | 155 | return [
|
156 | 156 | this.header.raw(),
|
157 |
| - this.transactions.map((tx) => tx.raw()), |
| 157 | + this.transactions.map((tx) => <Buffer[]>tx.raw()), |
158 | 158 | this.uncleHeaders.map((uh) => uh.raw()),
|
159 | 159 | ]
|
160 | 160 | }
|
@@ -223,7 +223,7 @@ export class Block {
|
223 | 223 | const errors: string[] = []
|
224 | 224 |
|
225 | 225 | this.transactions.forEach(function (tx, i) {
|
226 |
| - const errs = tx.validate(true) |
| 226 | + const errs = <string[]>tx.validate(true) |
227 | 227 | if (errs.length > 0) {
|
228 | 228 | errors.push(`errors at tx ${i}: ${errs.join(', ')}`)
|
229 | 229 | }
|
|
0 commit comments