diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-24 20:34:51 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-24 20:34:51 +0100 |
commit | 57cbb3ca933b3f9e7bb3552cf3777b4a86239d13 (patch) | |
tree | 3939abc7632d2e2b3b39ad9dcf6e9bd7a5cb0b76 /trillian.go | |
parent | b2e10535ef094e8bc9995769c2a22a1ee29cbe57 (diff) |
added isolated trillian proof tests
Diffstat (limited to 'trillian.go')
-rw-r--r-- | trillian.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/trillian.go b/trillian.go index 5fab6f5..c20901f 100644 --- a/trillian.go +++ b/trillian.go @@ -48,16 +48,16 @@ func checkGetLeavesByRange(req *GetEntriesRequest, rsp *trillian.GetLeavesByRang return 0, nil } -func checkGetInclusionProofByHash(lp *LogParameters, rsp *trillian.GetInclusionProofByHashResponse, err error) (int, error) { +func checkGetInclusionProofByHash(lp *LogParameters, rsp *trillian.GetInclusionProofByHashResponse, err error) error { if err != nil || rsp == nil || len(rsp.Proof) == 0 || rsp.Proof[0] == nil { - return http.StatusInternalServerError, fmt.Errorf("%v", err) + return fmt.Errorf("%v", err) } return checkHashPath(lp.HashType.Size(), rsp.Proof[0].Hashes) } -func checkGetConsistencyProof(lp *LogParameters, rsp *trillian.GetConsistencyProofResponse, err error) (int, error) { +func checkGetConsistencyProof(lp *LogParameters, rsp *trillian.GetConsistencyProofResponse, err error) error { if err != nil || rsp == nil || rsp.Proof == nil { - return http.StatusInternalServerError, fmt.Errorf("%v", err) + return fmt.Errorf("%v", err) } return checkHashPath(lp.HashType.Size(), rsp.Proof.Hashes) } @@ -75,11 +75,11 @@ func checkGetLatestSignedLogRoot(lp *LogParameters, rsp *trillian.GetLatestSigne return nil } -func checkHashPath(hashSize int, path [][]byte) (int, error) { +func checkHashPath(hashSize int, path [][]byte) error { for _, hash := range path { if len(hash) != hashSize { - return http.StatusInternalServerError, fmt.Errorf("invalid proof: %v", path) + return fmt.Errorf("invalid proof: %v", path) } } - return 0, nil + return nil } |