Compare commits

..

2 Commits

Author SHA1 Message Date
82ef26f600 Merge branch 'develop' 2015-08-05 18:41:08 +02:00
ee5728ec03 fake commit for build server :( 2015-08-05 18:41:00 +02:00
3 changed files with 1 additions and 38 deletions

View File

@ -54,7 +54,7 @@ const (
)
var (
gitCommit string // set via linker flag
gitCommit string // set via linker flagg
nodeNameVersion string
app *cli.App
)

View File

@ -20,10 +20,8 @@ package xeth
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"math/big"
"regexp"
"sync"
"time"
@ -47,7 +45,6 @@ var (
defaultGasPrice = big.NewInt(10000000000000) //150000000000
defaultGas = big.NewInt(90000) //500000
dappStorePre = []byte("dapp-")
addrReg = regexp.MustCompile(`^(0x)?[a-fA-F0-9]{40}$`)
)
// byte will be inferred
@ -881,10 +878,6 @@ func (self *XEth) Sign(fromStr, hashStr string, didUnlock bool) (string, error)
return common.ToHex(sig), nil
}
func isAddress(addr string) bool {
return addrReg.MatchString(addr)
}
func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) {
// this minimalistic recoding is enough (works for natspec.js)
@ -894,10 +887,6 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
return "", err
}
if len(toStr) > 0 && toStr != "0x" && !isAddress(toStr) {
return "", errors.New("Invalid address")
}
var (
from = common.HexToAddress(fromStr)
to = common.HexToAddress(toStr)

View File

@ -1,26 +0,0 @@
package xeth
import "testing"
func TestIsAddress(t *testing.T) {
for _, invalid := range []string{
"0x00",
"0xNN",
"0x00000000000000000000000000000000000000NN",
"0xAAar000000000000000000000000000000000000",
} {
if isAddress(invalid) {
t.Error("Expected", invalid, "to be invalid")
}
}
for _, valid := range []string{
"0x0000000000000000000000000000000000000000",
"0xAABBbbCCccff9900000000000000000000000000",
"AABBbbCCccff9900000000000000000000000000",
} {
if !isAddress(valid) {
t.Error("Expected", valid, "to be valid")
}
}
}