Commit a9ce2e3d2d7449ca0005d46cb47468fcfaf15223
Merge pull request #34 from ewasm/parent
Fix parent environment handlingwanderer authored on 10/6/2016, 8:16:16 AM
GitHub committed on 10/6/2016, 8:16:16 AM
Parent: 80cc9ff203abb03e4eb39d18d2801f1e2f0e52dd
Parent: 89c0461616621d14c849ba592bac2c9ca85978d9
Files changed
environment.js | changed |
environment.js | ||
---|---|---|
@@ -38,9 +38,9 @@ | ||
38 | 38 | account.set('nonce', trie.nonce || new U256(0)) |
39 | 39 | account.set('balance', trie.balance || new U256(0)) |
40 | 40 | account.set('code', trie.code || new Uint8Array()) |
41 | 41 | account.set('storage', trie.storage || new Map()) |
42 | - this.state.set(address.toString(), account) | |
42 | + this.parent.state.set(address.toString(), account) | |
43 | 43 | } |
44 | 44 | |
45 | 45 | isAccountPresent (address) { |
46 | 46 | const account = this.state.get(address.toString()) |
@@ -51,18 +51,18 @@ | ||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | getBalance (address) { |
55 | - const account = this.state.get(address.toString()) | |
55 | + const account = this.parent.state.get(address.toString()) | |
56 | 56 | if (account) { |
57 | 57 | return account.get('balance') |
58 | 58 | } else { |
59 | 59 | return new U256() |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | getCode (address) { |
64 | - const account = this.state.get(address.toString()) | |
64 | + const account = this.parent.state.get(address.toString()) | |
65 | 65 | if (account) { |
66 | 66 | return account.get('code') |
67 | 67 | } else { |
68 | 68 | return Uint8Array.from(new Buffer([])) |
Built with git-ssb-web