mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-26 05:17:19 +00:00
Added dns lookup
This commit is contained in:
parent
da50c75148
commit
7272577fe6
@ -15,6 +15,11 @@ func (self *Config) Get(name string) *Object {
|
|||||||
switch name {
|
switch name {
|
||||||
case "NameReg":
|
case "NameReg":
|
||||||
addr = []byte{0}
|
addr = []byte{0}
|
||||||
|
case "DomainReg":
|
||||||
|
objectAddr := configCtrl.GetStorage(ethutil.BigD([]byte{0}))
|
||||||
|
domainAddr := (&Object{self.pipe.World().safeGet(objectAddr.Bytes())}).StorageString("DomainReg").Bytes()
|
||||||
|
|
||||||
|
return &Object{self.pipe.World().safeGet(domainAddr)}
|
||||||
default:
|
default:
|
||||||
addr = ethutil.RightPadBytes([]byte(name), 32)
|
addr = ethutil.RightPadBytes([]byte(name), 32)
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/ethereum/eth-go/ethchain"
|
"github.com/ethereum/eth-go/ethchain"
|
||||||
"github.com/ethereum/eth-go/ethcrypto"
|
"github.com/ethereum/eth-go/ethcrypto"
|
||||||
"github.com/ethereum/eth-go/ethlog"
|
"github.com/ethereum/eth-go/ethlog"
|
||||||
|
"github.com/ethereum/eth-go/ethpipe"
|
||||||
"github.com/ethereum/eth-go/ethstate"
|
"github.com/ethereum/eth-go/ethstate"
|
||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
)
|
)
|
||||||
@ -41,6 +42,7 @@ func (self helper) NameReg() *ethstate.StateObject {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Re-write / refactor
|
||||||
type PEthereum struct {
|
type PEthereum struct {
|
||||||
manager ethchain.EthManager
|
manager ethchain.EthManager
|
||||||
stateManager *ethchain.StateManager
|
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 {
|
func (lib *PEthereum) GetBlock(hexHash string) *PBlock {
|
||||||
hash := ethutil.Hex2Bytes(hexHash)
|
hash := ethutil.Hex2Bytes(hexHash)
|
||||||
block := lib.blockChain.GetBlock(hash)
|
block := lib.blockChain.GetBlock(hash)
|
||||||
|
2
peer.go
2
peer.go
@ -449,7 +449,7 @@ func (p *Peer) HandleInbound() {
|
|||||||
peerlogger.Infof("Attempting to catch (%x). Parent unknown\n", b.Hash())
|
peerlogger.Infof("Attempting to catch (%x). Parent unknown\n", b.Hash())
|
||||||
p.catchingUp = false
|
p.catchingUp = false
|
||||||
|
|
||||||
p.CatchupWithPeer(b.Hash())
|
p.CatchupWithPeer(b.PrevHash)
|
||||||
|
|
||||||
peerlogger.Infoln(b)
|
peerlogger.Infoln(b)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user