diff options
author | zelig <viktor.tron@gmail.com> | 2014-08-14 18:11:59 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-08-14 18:11:59 +0800 |
commit | 0283498140636e02170ab05e400aa68441018c32 (patch) | |
tree | c42f3e9ddc402516f6b748386840d04198863be7 | |
parent | e85f3972b9b4648666c6b50fff04938e3206ff96 (diff) | |
parent | fa881220aedb638f9ee35337b2ca1817c2a8482f (diff) | |
download | go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar.gz go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar.bz2 go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar.lz go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar.xz go-tangerine-0283498140636e02170ab05e400aa68441018c32.tar.zst go-tangerine-0283498140636e02170ab05e400aa68441018c32.zip |
Merge branch 'develop' of github.com:ethereum/eth-go into develop
-rw-r--r-- | ethchain/bloom.go | 2 | ||||
-rw-r--r-- | ethpub/pub.go | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ethchain/bloom.go b/ethchain/bloom.go index 320ce73fc..5317ca0b1 100644 --- a/ethchain/bloom.go +++ b/ethchain/bloom.go @@ -6,7 +6,7 @@ type BloomFilter struct { func NewBloomFilter(bin []byte) *BloomFilter { if bin == nil { - bin = make([]byte, 255) + bin = make([]byte, 256) } return &BloomFilter{ diff --git a/ethpub/pub.go b/ethpub/pub.go index ab2aae599..762c9a60f 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "math/big" + "strconv" "strings" "sync/atomic" @@ -74,8 +75,22 @@ func (self *PEthereum) LookupDomain(domain string) string { if len(domain) > 32 { domain = string(ethcrypto.Sha3Bin([]byte(domain))) } + data := world.Config().Get("DnsReg").StorageString(domain).Bytes() + + // Left padded = A record, Right padded = CNAME + if data[0] == 0 { + data = bytes.TrimLeft(data, "\x00") + var ipSlice []string + for _, d := range data { + ipSlice = append(ipSlice, strconv.Itoa(int(d))) + } + + return strings.Join(ipSlice, ".") + } else { + data = bytes.TrimRight(data, "\x00") - return strings.Trim(world.Config().Get("DnsReg").StorageString(domain).Str(), "\x00") + return string(data) + } } func (lib *PEthereum) GetBlock(hexHash string) *PBlock { |