mirror of https://github.com/poanetwork/quorum.git
Added StringToBytesFunc
This commit is contained in:
parent
8278ba5e45
commit
65722aeeca
|
@ -448,7 +448,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
|
||||||
closure.Price)
|
closure.Price)
|
||||||
// Call the closure and set the return value as
|
// Call the closure and set the return value as
|
||||||
// main script.
|
// main script.
|
||||||
c.Script, _, err = c.Call(vm, nil, hook)
|
c.Script, gas, err = c.Call(vm, nil, hook)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
stack.Push(ethutil.BigFalse)
|
stack.Push(ethutil.BigFalse)
|
||||||
|
|
|
@ -88,3 +88,13 @@ func IsHex(str string) bool {
|
||||||
l := len(str)
|
l := len(str)
|
||||||
return l >= 4 && l%2 == 0 && str[0:2] == "0x"
|
return l >= 4 && l%2 == 0 && str[0:2] == "0x"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) {
|
||||||
|
if str[0:2] == "0x" {
|
||||||
|
ret = FromHex(str[2:])
|
||||||
|
} else {
|
||||||
|
ret = cb(str)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue