changed name for ethutil hex functions

poc8
zelig 11 years ago
parent 2d48fc1113
commit e38b016547
  1. 10
      ethereum/javascript_runtime.go

@ -122,12 +122,12 @@ out:
} }
case object := <-self.changeChan: case object := <-self.changeChan:
if stateObject, ok := object.Resource.(*ethchain.StateObject); ok { if stateObject, ok := object.Resource.(*ethchain.StateObject); ok {
for _, cb := range self.objectCb[ethutil.Hex(stateObject.Address())] { for _, cb := range self.objectCb[ethutil.Bytes2Hex(stateObject.Address())] {
val, _ := self.vm.ToValue(ethpub.NewPStateObject(stateObject)) val, _ := self.vm.ToValue(ethpub.NewPStateObject(stateObject))
cb.Call(cb, val) cb.Call(cb, val)
} }
} else if storageObject, ok := object.Resource.(*ethchain.StorageState); ok { } else if storageObject, ok := object.Resource.(*ethchain.StorageState); ok {
for _, cb := range self.objectCb[ethutil.Hex(storageObject.StateAddress)+ethutil.Hex(storageObject.Address)] { for _, cb := range self.objectCb[ethutil.Bytes2Hex(storageObject.StateAddress)+ethutil.Bytes2Hex(storageObject.Address)] {
val, _ := self.vm.ToValue(ethpub.NewPStorageState(storageObject)) val, _ := self.vm.ToValue(ethpub.NewPStorageState(storageObject))
cb.Call(cb, val) cb.Call(cb, val)
} }
@ -178,12 +178,12 @@ func (self *JSRE) watch(call otto.FunctionCall) otto.Value {
if storageCallback { if storageCallback {
self.objectCb[addr+storageAddr] = append(self.objectCb[addr+storageAddr], cb) self.objectCb[addr+storageAddr] = append(self.objectCb[addr+storageAddr], cb)
event := "storage:" + string(ethutil.FromHex(addr)) + ":" + string(ethutil.FromHex(storageAddr)) event := "storage:" + string(ethutil.Hex2Bytes(addr)) + ":" + string(ethutil.Hex2Bytes(storageAddr))
self.ethereum.Reactor().Subscribe(event, self.changeChan) self.ethereum.Reactor().Subscribe(event, self.changeChan)
} else { } else {
self.objectCb[addr] = append(self.objectCb[addr], cb) self.objectCb[addr] = append(self.objectCb[addr], cb)
event := "object:" + string(ethutil.FromHex(addr)) event := "object:" + string(ethutil.Hex2Bytes(addr))
self.ethereum.Reactor().Subscribe(event, self.changeChan) self.ethereum.Reactor().Subscribe(event, self.changeChan)
} }
@ -221,7 +221,7 @@ func (self *JSRE) execBlock(call otto.FunctionCall) otto.Value {
return otto.UndefinedValue() return otto.UndefinedValue()
} }
err = utils.BlockDo(self.ethereum, ethutil.FromHex(hash)) err = utils.BlockDo(self.ethereum, ethutil.Hex2Bytes(hash))
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return otto.FalseValue() return otto.FalseValue()

Loading…
Cancel
Save