(╯°□°)╯︵ ┻━┻

This commit is contained in:
Jae Kwon
2015-04-17 17:39:50 -07:00
parent 2668b59631
commit b11ca1bbfc
12 changed files with 27 additions and 21 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ func GetStorage(address, key []byte) (*ctypes.ResponseGetStorage, error) {
storageRoot := account.StorageRoot
storageTree := state.LoadStorage(storageRoot)
_, value := storageTree.Get(RightPadWord256(key).Bytes())
_, value := storageTree.Get(LeftPadWord256(key).Bytes())
if value == nil {
return &ctypes.ResponseGetStorage{key, nil}, nil
}
+4 -5
View File
@@ -12,11 +12,11 @@ import (
func toVMAccount(acc *account.Account) *vm.Account {
return &vm.Account{
Address: RightPadWord256(acc.Address),
Address: LeftPadWord256(acc.Address),
Balance: acc.Balance,
Code: acc.Code, // This is crazy.
Nonce: uint64(acc.Sequence),
StorageRoot: RightPadWord256(acc.StorageRoot),
StorageRoot: LeftPadWord256(acc.StorageRoot),
Other: acc.PubKey,
}
}
@@ -26,7 +26,6 @@ func toVMAccount(acc *account.Account) *vm.Account {
// Run a contract's code on an isolated and unpersisted state
// Cannot be used to create new contracts
func Call(address, data []byte) (*ctypes.ResponseCall, error) {
st := consensusState.GetState() // performs a copy
cache := mempoolReactor.Mempool.GetCache()
outAcc := cache.GetAccount(address)
@@ -38,7 +37,7 @@ func Call(address, data []byte) (*ctypes.ResponseCall, error) {
txCache := state.NewTxCache(cache)
params := vm.Params{
BlockHeight: uint64(st.LastBlockHeight),
BlockHash: RightPadWord256(st.LastBlockHash),
BlockHash: LeftPadWord256(st.LastBlockHash),
BlockTime: st.LastBlockTime.Unix(),
GasLimit: 10000000,
}
@@ -63,7 +62,7 @@ func CallCode(code, data []byte) (*ctypes.ResponseCall, error) {
txCache := state.NewTxCache(cache)
params := vm.Params{
BlockHeight: uint64(st.LastBlockHeight),
BlockHash: RightPadWord256(st.LastBlockHash),
BlockHash: LeftPadWord256(st.LastBlockHash),
BlockTime: st.LastBlockTime.Unix(),
GasLimit: 10000000,
}