Commit 730ac04e07656503bbe553e2c9bf298a7ee53170
set all the block getter's to use the block
wanderer authored on 8/17/2016, 10:26:30 PMAlex Beregszaszi committed on 8/23/2016, 12:08:55 AM
Parent: 865f135bbd80624eceea4b85923acc13137ffd39
Files changed
environment.js | changed |
interface.js | changed |
environment.js | ||
---|---|---|
@@ -10,18 +10,15 @@ | ||
10 | 10 | const block = new Block() |
11 | 11 | |
12 | 12 | const defaults = { |
13 | 13 | block: block, |
14 | - number: ethUtils.bufferToInt(block.header.number), | |
15 | 14 | // gas tank |
16 | 15 | gasPrice: 0, |
17 | 16 | gasLimit: 1000000, // The gas limit for the block |
18 | 17 | gasRefund: 0, |
19 | 18 | // call infromation |
20 | 19 | address: new Address('0x0000000000000000000000000000000000000000'), |
21 | 20 | origin: new Address('0x0000000000000000000000000000000000000000'), |
22 | - coinbase: new Address('0x0000000000000000000000000000000000000000'), | |
23 | - difficulty: 0, | |
24 | 21 | caller: new Address('0x0000000000000000000000000000000000000000'), |
25 | 22 | callValue: new U256(0), |
26 | 23 | callData: new Uint8Array(), |
27 | 24 | // the ROM |
interface.js | ||
---|---|---|
@@ -232,9 +232,9 @@ | ||
232 | 232 | */ |
233 | 233 | getBlockHash (number, offset) { |
234 | 234 | this.takeGas(20) |
235 | 235 | |
236 | - const diff = this.environment.number - number | |
236 | + const diff = this.environment.block.header.number - number | |
237 | 237 | let hash |
238 | 238 | |
239 | 239 | if (diff > 256 || diff <= 0) { |
240 | 240 | hash = new U256(0) |
@@ -250,9 +250,9 @@ | ||
250 | 250 | */ |
251 | 251 | getBlockCoinbase (offset) { |
252 | 252 | this.takeGas(2) |
253 | 253 | |
254 | - this.setMemory(offset, constants.ADDRESS_SIZE_BYTES, this.environment.coinbase) | |
254 | + this.setMemory(offset, constants.ADDRESS_SIZE_BYTES, this.environment.block.header.coinbase) | |
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Get the block’s timestamp. |
@@ -260,9 +260,9 @@ | ||
260 | 260 | */ |
261 | 261 | getBlockTimestamp () { |
262 | 262 | this.takeGas(2) |
263 | 263 | |
264 | - return this.environment.timestamp | |
264 | + return this.environment.block.header.timestamp | |
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Get the block’s number. |
@@ -270,9 +270,9 @@ | ||
270 | 270 | */ |
271 | 271 | getBlockNumber () { |
272 | 272 | this.takeGas(2) |
273 | 273 | |
274 | - return this.environment.number | |
274 | + return this.environment.block.header.number | |
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Get the block’s difficulty. |
@@ -280,9 +280,9 @@ | ||
280 | 280 | */ |
281 | 281 | getBlockDifficulty () { |
282 | 282 | this.takeGas(2) |
283 | 283 | |
284 | - return this.environment.difficulty | |
284 | + return this.environment.block.header.difficulty | |
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Get the block’s gas limit. |
@@ -290,9 +290,9 @@ | ||
290 | 290 | */ |
291 | 291 | getBlockGasLimit () { |
292 | 292 | this.takeGas(2) |
293 | 293 | |
294 | - return this.environment.gasLimit | |
294 | + return this.environment.block.header.gasLimit | |
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | 298 | * Creates a new log in the current environment |
Built with git-ssb-web