git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 367c578a5d2ee433099674d1e53a194032ca3e14

this fixes the accounts by making them Maps

wanderer committed on 8/26/2016, 3:23:54 PM
Parent: 44c70314f4cb4bdce4bf22769116f514334368fd

Files changed

environment.jschanged
testEnvironment.jschanged
environment.jsView
@@ -43,18 +43,18 @@
4343
4444 getBalance (address) {
4545 const account = this.state.get(address.toString())
4646 if (account) {
47- return account['balance']
47+ return account.get('balance')
4848 } else {
4949 return new U256()
5050 }
5151 }
5252
5353 getCode (address) {
5454 const account = this.state.get(address.toString())
5555 if (account) {
56- return account['code']
56+ return account.get('code')
5757 } else {
5858 return Uint8Array.from(new Buffer([]))
5959 }
6060 }
testEnvironment.jsView
@@ -16,11 +16,11 @@
1616
1717 if (data.accounts) {
1818 data.accounts.forEach((account) => {
1919 let tmp = account[1]
20- self.state.set(new Address(account[0]).toString(), {
21- balance: new U256(tmp.balance)
22- })
20+ self.state.set(new Address(account[0]).toString(), new Map(
21+ [['balance', new U256(tmp.balance)]]
22+ ))
2323 })
2424 }
2525
2626 if (data.address) {

Built with git-ssb-web