swarm/storage: Simplify code, correct content hashing

This commit is contained in:
lash 2018-01-18 01:13:13 +01:00
parent f68e83683d
commit 3d92c93888
2 changed files with 10 additions and 0 deletions

View file

@ -36,6 +36,7 @@ func NewENSValidator(contractaddress common.Address, backend bind.ContractBacken
if err != nil { if err != nil {
return nil, err return nil, err
} }
validator.hashlength = len(ens.EnsNode(dbDirName).Bytes())
return validator, nil return validator, nil
} }

View file

@ -333,6 +333,15 @@ func setupTest(contractbackend bind.ContractBackend, validator ResourceValidator
} }
} }
if validator == nil {
// create a new signer, which creates the private key
signer, err = newTestSigner()
if err != nil {
return
}
validator = NewGenericValidator(testHashFunc, signer.signContent)
}
// temp datadir // temp datadir
datadir, err = ioutil.TempDir("", "rh") datadir, err = ioutil.TempDir("", "rh")
if err != nil { if err != nil {