Proper checks for multiple data items. Fixes #80
This commit is contained in:
parent
dc9c9369e0
commit
2fbcfd8824
|
@ -170,11 +170,6 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, sc
|
|||
|
||||
tx = ethchain.NewContractCreationTx(value, gas, gasPrice, script)
|
||||
} else {
|
||||
// Just in case it was submitted as a 0x prefixed string
|
||||
if len(scriptStr) > 0 && scriptStr[0:2] == "0x" {
|
||||
scriptStr = scriptStr[2:len(scriptStr)]
|
||||
}
|
||||
|
||||
data := ethutil.StringToByteFunc(scriptStr, func(s string) (ret []byte) {
|
||||
slice := strings.Split(s, "\n")
|
||||
for _, dataItem := range slice {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Number to bytes
|
||||
|
@ -91,7 +92,7 @@ func IsHex(str string) bool {
|
|||
}
|
||||
|
||||
func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) {
|
||||
if len(str) > 1 && str[0:2] == "0x" {
|
||||
if len(str) > 1 && str[0:2] == "0x" && !strings.Contains(str, "\n") {
|
||||
ret = FromHex(str[2:])
|
||||
} else {
|
||||
ret = cb(str)
|
||||
|
|
Loading…
Reference in New Issue