Commit a4de660ae609d19d9547c07d2c507253598aa2bf
Merge pull request #21 from ewasm/blockhash
implemented blockHash stubwanderer authored on 8/18/2016, 2:05:56 AM
GitHub committed on 8/18/2016, 2:05:56 AM
Parent: 1258de512d97564568307c5b1f4041dd7a10820f
Parent: 5eb51da3f2ba58b98e6d220d7c90faccdb75b6b6
Files changed
environment.js | changed |
package.json | changed |
fakeBlockChain.js | added |
environment.js | ||
---|---|---|
@@ -1,11 +1,18 @@ | ||
1 | 1 | const constants = require('./constants.js') |
2 | 2 | const U256 = require('./u256.js') |
3 | 3 | const Address = require('./address.js') |
4 | +const ethUtils = require('ethereumjs-util') | |
5 | +const Block = require('ethereumjs-block') | |
6 | +const blockChain = require('./fakeBlockChain.js') | |
4 | 7 | |
5 | 8 | module.exports = class Environment { |
6 | 9 | constructor (data) { |
10 | + const block = new Block() | |
11 | + | |
7 | 12 | const defaults = { |
13 | + block: block, | |
14 | + number: ethUtils.bufferToInt(block.header.number), | |
8 | 15 | // gas tank |
9 | 16 | gasPrice: 0, |
10 | 17 | gasLimit: 1000000, // The gas limit for the block |
11 | 18 | gasRefund: 0, |
@@ -39,9 +46,9 @@ | ||
39 | 46 | return this.state.get(address.toString()).code |
40 | 47 | } |
41 | 48 | |
42 | 49 | getBlockHash (height) { |
43 | - // STUB | |
50 | + return blockChain.getBlock(height).hash() | |
44 | 51 | } |
45 | 52 | |
46 | 53 | // kernal |
47 | 54 | create (code, value) { |
Built with git-ssb-web