diff options
author | zelig <viktor.tron@gmail.com> | 2015-07-06 02:19:42 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-07 16:43:49 +0800 |
commit | 1208ac83d5a93214f23bf3f9236e29869ee62407 (patch) | |
tree | 28d07022d6fbda7a4cf9478ae7341c217ff200f1 /common/registrar | |
parent | aa22cf323ef408f0562817352f68197f8b982f75 (diff) | |
download | dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.gz dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.bz2 dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.lz dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.xz dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.zst dexon-1208ac83d5a93214f23bf3f9236e29869ee62407.zip |
fix natspec test
* registar url string retrieval chop leading zeros now
* rewrite test using test mining
* remove temporary applyTxs from xeth
Diffstat (limited to 'common/registrar')
-rw-r--r-- | common/registrar/registrar.go | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/common/registrar/registrar.go b/common/registrar/registrar.go index 457dd6894..262231762 100644 --- a/common/registrar/registrar.go +++ b/common/registrar/registrar.go @@ -339,22 +339,15 @@ func (self *Registrar) HashToUrl(chash common.Hash) (uri string, err error) { key := storageAddress(storageFixedArray(mapaddr, storageIdx2Addr(idx))) hex := self.backend.StorageAt(UrlHintAddr[2:], key) str = string(common.Hex2Bytes(hex[2:])) - l := len(str) - for (l > 0) && (str[l-1] == 0) { - l-- + l := 0 + for (l < len(str)) && (str[l] == 0) { + l++ } - str = str[:l] + str = str[l:] uri = uri + str idx++ } - - l := 0 - for (l < len(uri)) && (uri[l] == 0) { - l++ - } - uri = uri[l:] - if len(uri) == 0 { err = fmt.Errorf("GetURLhint: URL hint not found for '%v'", chash.Hex()) } |