Update public methods signatures

- Update public methods signatures
- Remove 'lastAccess' param
- Add option to pass root for tree.Dump, Iterate, IterateWithStop,
Graphviz (and related)
- Move error messages to const defined error messages for external usage
This commit is contained in:
arnaucube
2021-05-26 17:01:09 +02:00
parent f24fb28266
commit 0b2c3b07ed
8 changed files with 224 additions and 181 deletions

View File

@@ -37,8 +37,8 @@ type HashFunction interface {
Type() []byte
Len() int
Hash(...[]byte) ([]byte, error)
// CheckInputs checks if the inputs are valid without computing the hash
// CheckInputs(...[]byte) error
// CheckInput checks if the input is valid without computing the hash
// CheckInput(...[]byte) error
}
// HashSha256 implements the HashFunction interface for the Sha256 hash
@@ -88,7 +88,7 @@ func (f HashPoseidon) Hash(b ...[]byte) ([]byte, error) {
if err != nil {
return nil, err
}
hB := BigIntToBytes(h)
hB := BigIntToBytes(f.Len(), h)
return hB, nil
}