aboutsummaryrefslogtreecommitdiff
path: root/trillian.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-23 21:36:00 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-23 21:36:00 +0100
commitb2e10535ef094e8bc9995769c2a22a1ee29cbe57 (patch)
treeadce4aaef9978a04e09d24499f99752c6d2dbf8c /trillian.go
parent15444f91e74de6e1ca8ea99511e8cb6dcd92fa91 (diff)
added start on isolated trillian checks
Diffstat (limited to 'trillian.go')
-rw-r--r--trillian.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/trillian.go b/trillian.go
index 8ae96a1..5fab6f5 100644
--- a/trillian.go
+++ b/trillian.go
@@ -11,15 +11,15 @@ import (
"google.golang.org/grpc/codes"
)
-func checkQueueLeaf(rsp *trillian.QueueLeafResponse, err error) (int, error) {
+func checkQueueLeaf(rsp *trillian.QueueLeafResponse, err error) error {
if err != nil || rsp == nil || rsp.QueuedLeaf == nil {
- return http.StatusInternalServerError, fmt.Errorf("%v", err)
+ return fmt.Errorf("%v", err)
}
if codes.Code(rsp.QueuedLeaf.GetStatus().GetCode()) == codes.AlreadyExists {
// no need to report this as an invalid request, just (re)issue sdi
glog.V(3).Infof("queued leaf is a duplicate => %X", rsp.QueuedLeaf.Leaf.LeafValue)
}
- return 0, nil
+ return nil
}
func checkGetLeavesByRange(req *GetEntriesRequest, rsp *trillian.GetLeavesByRangeResponse, err error) (int, error) {
@@ -62,17 +62,17 @@ func checkGetConsistencyProof(lp *LogParameters, rsp *trillian.GetConsistencyPro
return checkHashPath(lp.HashType.Size(), rsp.Proof.Hashes)
}
-func checkGetLatestSignedLogRoot(lp *LogParameters, rsp *trillian.GetLatestSignedLogRootResponse, err error, out *types.LogRootV1) (int, error) {
+func checkGetLatestSignedLogRoot(lp *LogParameters, rsp *trillian.GetLatestSignedLogRootResponse, err error, out *types.LogRootV1) error {
if err != nil || rsp == nil || rsp.SignedLogRoot == nil || rsp.SignedLogRoot.LogRoot == nil {
- return http.StatusInternalServerError, fmt.Errorf("%v", err)
+ return fmt.Errorf("%v", err)
}
if err := out.UnmarshalBinary(rsp.SignedLogRoot.LogRoot); err != nil {
- return http.StatusInternalServerError, fmt.Errorf("cannot unmarshal log root: %v", err)
+ return fmt.Errorf("cannot unmarshal log root: %v", err)
}
if len(out.RootHash) != lp.HashType.Size() {
- return http.StatusInternalServerError, fmt.Errorf("invalid root hash: %v", out.RootHash)
+ return fmt.Errorf("invalid root hash: %v", out.RootHash)
}
- return 0, nil
+ return nil
}
func checkHashPath(hashSize int, path [][]byte) (int, error) {