aboutsummaryrefslogtreecommitdiff
path: root/pkg/instance/instance.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-07 16:03:36 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-07 16:03:36 +0200
commit60d6b27b964d149f51bca5d1990698700e280051 (patch)
tree08fa1f4041da05cb34768c6b99d21b4ff747474f /pkg/instance/instance.go
parentd9bb0871ad197ad9f17d265c027b722eda678a84 (diff)
added more instance tests
Diffstat (limited to 'pkg/instance/instance.go')
-rw-r--r--pkg/instance/instance.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index c2fe8fa..536eb60 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -110,7 +110,7 @@ func (i *Instance) leafRequestFromHTTP(r *http.Request) (*types.LeafRequest, err
func (i *Instance) cosignatureRequestFromHTTP(r *http.Request) (*types.CosignatureRequest, error) {
var req types.CosignatureRequest
if err := req.UnmarshalASCII(r.Body); err != nil {
- return nil, fmt.Errorf("unpackOctetPost: %v", err)
+ return nil, fmt.Errorf("UnmarshalASCII: %v", err)
}
if _, ok := i.Witnesses[*req.KeyHash]; !ok {
return nil, fmt.Errorf("Unknown witness: %x", req.KeyHash)
@@ -137,8 +137,10 @@ func (i *Instance) inclusionProofRequestFromHTTP(r *http.Request) (*types.Inclus
if err := req.UnmarshalASCII(r.Body); err != nil {
return nil, fmt.Errorf("UnmarshalASCII: %v", err)
}
- if req.TreeSize < 1 {
- return nil, fmt.Errorf("TreeSize(%d) must be larger than zero", req.TreeSize)
+ if req.TreeSize < 2 {
+ // TreeSize:0 => not possible to prove inclusion of anything
+ // TreeSize:1 => you don't need an inclusion proof (it is always empty)
+ return nil, fmt.Errorf("TreeSize(%d) must be larger than one", req.TreeSize)
}
return &req, nil
}