diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-18 04:30:00 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-18 04:30:00 +0800 |
commit | 28a146d438b0c11820aef5d9551c6eff929acdec (patch) | |
tree | 966fa6ed1e19eab92427e098aa359f36fe1789f6 | |
parent | 6a19b62db6466f88132f5e41868336ff74ef969c (diff) | |
download | dexon-28a146d438b0c11820aef5d9551c6eff929acdec.tar.gz dexon-28a146d438b0c11820aef5d9551c6eff929acdec.tar.zst dexon-28a146d438b0c11820aef5d9551c6eff929acdec.zip |
Added find name for namereg
-rw-r--r-- | ethpub/pub.go | 13 | ||||
-rw-r--r-- | ethpub/types.go | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go index f409d136b..5d01a7a44 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -179,6 +179,19 @@ func FindAddressInNameReg(stateManager *ethchain.StateManager, name string) []by return nil } +func FindNameInNameReg(stateManager *ethchain.StateManager, addr []byte) string { + nameReg := EthereumConfig(stateManager).NameReg() + if nameReg != nil { + addr = ethutil.LeftPadBytes(addr, 32) + + reg := nameReg.GetStorage(ethutil.BigD(addr)) + + return strings.TrimRight(reg.Str(), "\x00") + } + + return "" +} + func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, scriptStr string) (*PReceipt, error) { var hash []byte var contractCreation bool diff --git a/ethpub/types.go b/ethpub/types.go index bd1afc007..9e5159a4c 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -47,6 +47,7 @@ type PBlock struct { Transactions string `json:"transactions"` Time int64 `json:"time"` Coinbase string `json:"coinbase"` + Name string `json:"name"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` } |