diff options
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/pub.go | 13 | ||||
-rw-r--r-- | ethpub/types.go | 6 |
2 files changed, 19 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 5d41269c8..9e5159a4c 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethcrypto" + "github.com/ethereum/eth-go/ethtrie" "github.com/ethereum/eth-go/ethutil" "strings" ) @@ -46,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"` } @@ -212,6 +214,10 @@ func (c *PStateObject) IsContract() bool { return false } +func (self *PStateObject) EachStorage(cb ethtrie.EachCallback) { + self.object.State().EachStorage(cb) +} + type KeyVal struct { Key string Value string |