aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub/pub.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-07 21:11:54 +0800
committerobscuren <geffobscura@gmail.com>2014-08-07 21:11:54 +0800
commit7272577fe651a20618cf428475e2e57976c9599d (patch)
treeb2255ddc9a361df1ba7c47652d551dba6a23089e /ethpub/pub.go
parentda50c751480da32036f41ccbeb1f292694ca0286 (diff)
downloadgo-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar.gz
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar.bz2
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar.lz
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar.xz
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.tar.zst
go-tangerine-7272577fe651a20618cf428475e2e57976c9599d.zip
Added dns lookup
Diffstat (limited to 'ethpub/pub.go')
-rw-r--r--ethpub/pub.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go
index f971313d8..3fb4c4920 100644
--- a/ethpub/pub.go
+++ b/ethpub/pub.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethpipe"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
)
@@ -41,6 +42,7 @@ func (self helper) NameReg() *ethstate.StateObject {
return nil
}
+// TODO Re-write / refactor
type PEthereum struct {
manager ethchain.EthManager
stateManager *ethchain.StateManager
@@ -65,6 +67,17 @@ func New(manager ethchain.EthManager) *PEthereum {
}
}
+func (self *PEthereum) LookupDomain(domain string) string {
+ pipe := ethpipe.New(self.manager)
+ world := pipe.World()
+
+ if len(domain) > 32 {
+ domain = string(ethcrypto.Sha3Bin([]byte(domain)))
+ }
+
+ return strings.Trim(world.Config().Get("DomainReg").StorageString(domain).Str(), "\x00")
+}
+
func (lib *PEthereum) GetBlock(hexHash string) *PBlock {
hash := ethutil.Hex2Bytes(hexHash)
block := lib.blockChain.GetBlock(hash)