Commit c37a0e4f79312b8d2c82aea3bfeee95a6f812586
Kernel: use addAccount helper
Alex Beregszaszi committed on 8/23/2016, 12:27:46 AMParent: 18cbe174144e02f5d3b3ba532286239bee873366
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -129,18 +129,15 @@ | ||
129 | 129 | if (tx.to.isZero()) { |
130 | 130 | if (tx.data.length !== 0) { |
131 | 131 | console.log('This is a contract deployment transaction') |
132 | 132 | |
133 | - let account = new Map() | |
134 | - account.set('nonce', new U256(0)) | |
135 | - account.set('balance', tx.value) | |
136 | - account.set('code', tx.data) | |
137 | - account.set('storage', new Map()) | |
133 | + let address = Utils.newAccountAddress(tx.from, tx.data) | |
138 | 134 | |
139 | - let address = address = Utils.newAccountAddress(tx.from, tx.data) | |
135 | + this.environment.addAccount(address.toString(), { | |
136 | + balance: tx.value, | |
137 | + code: tx.data | |
138 | + }) | |
140 | 139 | |
141 | - this.environment.state.set(address.toString(), account) | |
142 | - | |
143 | 140 | // FIXME: deduct fees |
144 | 141 | |
145 | 142 | return { |
146 | 143 | accountCreated: address |
Built with git-ssb-web