fix natspec test

* registar url string retrieval chop leading zeros now
* rewrite test using test mining
* remove temporary applyTxs from xeth
This commit is contained in:
zelig
2015-07-05 19:19:42 +01:00
committed by Jeffrey Wilcke
parent aa22cf323e
commit 1208ac83d5
6 changed files with 99 additions and 81 deletions

View File

@ -22,6 +22,7 @@ func New(docRoot string) (self *DocServer) {
DocRoot: docRoot,
schemes: []string{"file"},
}
self.DocRoot = "/tmp/"
self.RegisterProtocol("file", http.NewFileTransport(http.Dir(self.DocRoot)))
return
}
@ -52,20 +53,16 @@ func (self *DocServer) HasScheme(scheme string) bool {
func (self *DocServer) GetAuthContent(uri string, hash common.Hash) (content []byte, err error) {
// retrieve content
url := uri
fmt.Printf("uri: %v\n", url)
content, err = self.Get(url, "")
content, err = self.Get(uri, "")
if err != nil {
return
}
// check hash to authenticate content
hashbytes := crypto.Sha3(content)
var chash common.Hash
copy(chash[:], hashbytes)
chash := crypto.Sha3Hash(content)
if chash != hash {
content = nil
err = fmt.Errorf("content hash mismatch")
err = fmt.Errorf("content hash mismatch %x != %x (exp)", hash[:], chash[:])
}
return