diff options
author | zelig <viktor.tron@gmail.com> | 2015-06-23 22:48:33 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-07 16:43:31 +0800 |
commit | 83ee39448e0f23d42dff27bccde27f828afa3707 (patch) | |
tree | 429fa8f20a4bc017a58ffc4c7c0ed8596d1d206f /common/registrar/ethreg/ethreg.go | |
parent | d764bd058457cd9eb91d205d1ac187d40c4866d6 (diff) | |
download | dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.gz dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.bz2 dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.lz dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.xz dexon-83ee39448e0f23d42dff27bccde27f828afa3707.tar.zst dexon-83ee39448e0f23d42dff27bccde27f828afa3707.zip |
Registrar and contractInfo handling
* resolver -> common/registrar
* global registrar name registry interface
* add Call to resolver backend interface
* the hashReg and UrlHing contracts now initialised from global registry
* initialization of contracts uniform
* improve errors and more econsistent method names
* common/registrar/ethreg: versioned registrar
* integrate new naming and registrar in natspec
* js console api: setGlobalRegistrar, setHashReg, setUrlHint
* js test TestContract uses mining - tests fixed all pass
* eth/backend: allow PoW test mode (small ethash DAG)
* console jsre refers to resolver.abi/addr,
* cmd/geth/contracts.go moved to common/registrar
Diffstat (limited to 'common/registrar/ethreg/ethreg.go')
-rw-r--r-- | common/registrar/ethreg/ethreg.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/common/registrar/ethreg/ethreg.go b/common/registrar/ethreg/ethreg.go new file mode 100644 index 000000000..f5ad3345b --- /dev/null +++ b/common/registrar/ethreg/ethreg.go @@ -0,0 +1,32 @@ +package ethreg + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common/registrar" + "github.com/ethereum/go-ethereum/xeth" +) + +// implements a versioned Registrar on an archiving full node +type EthReg struct { + backend *xeth.XEth + registry *registrar.Registrar +} + +func New(xe *xeth.XEth) (self *EthReg) { + self = &EthReg{backend: xe} + self.registry = registrar.New(xe) + return +} + +func (self *EthReg) Registry() *registrar.Registrar { + return self.registry +} + +func (self *EthReg) Resolver(n *big.Int) *registrar.Registrar { + xe := self.backend + if n != nil { + xe = self.backend.AtStateNum(n.Int64()) + } + return registrar.New(xe) +} |