aboutsummaryrefslogtreecommitdiffstats
path: root/common/docserver
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-07-06 02:19:42 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:43:49 +0800
commit1208ac83d5a93214f23bf3f9236e29869ee62407 (patch)
tree28d07022d6fbda7a4cf9478ae7341c217ff200f1 /common/docserver
parentaa22cf323ef408f0562817352f68197f8b982f75 (diff)
downloadgo-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar
go-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.gz
go-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.bz2
go-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.lz
go-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.xz
go-tangerine-1208ac83d5a93214f23bf3f9236e29869ee62407.tar.zst
go-tangerine-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/docserver')
-rw-r--r--common/docserver/docserver.go11
-rw-r--r--common/docserver/docserver_test.go2
2 files changed, 5 insertions, 8 deletions
diff --git a/common/docserver/docserver.go b/common/docserver/docserver.go
index c890cd3f5..6b0cd3130 100644
--- a/common/docserver/docserver.go
+++ b/common/docserver/docserver.go
@@ -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
diff --git a/common/docserver/docserver_test.go b/common/docserver/docserver_test.go
index 09b16864a..ca126071c 100644
--- a/common/docserver/docserver_test.go
+++ b/common/docserver/docserver_test.go
@@ -27,7 +27,7 @@ func TestGetAuthContent(t *testing.T) {
hash = common.Hash{}
content, err = ds.GetAuthContent("file:///test.content", hash)
- expected := "content hash mismatch"
+ expected := "content hash mismatch 0000000000000000000000000000000000000000000000000000000000000000 != 9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658 (exp)"
if err == nil {
t.Errorf("expected error, got nothing")
} else {