aboutsummaryrefslogtreecommitdiff
path: root/pkg/instance/handler.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-01-25 01:06:54 +0100
committerRasmus Dahlberg <rasmus@mullvad.net>2022-01-26 01:17:24 +0100
commitdf8455a97090cb06e26a881162b86887c4dfcca5 (patch)
tree3e1b9a66736a693f2da9f5cdbb581620e77d7687 /pkg/instance/handler.go
parenta8df88efdb0adf014e524c813193228d06e9ac6a (diff)
instance: Use the new tree-head endpoints
Diffstat (limited to 'pkg/instance/handler.go')
-rw-r--r--pkg/instance/handler.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/pkg/instance/handler.go b/pkg/instance/handler.go
index 66a20a5..f2bc621 100644
--- a/pkg/instance/handler.go
+++ b/pkg/instance/handler.go
@@ -79,21 +79,9 @@ func addCosignature(ctx context.Context, i *Instance, w http.ResponseWriter, r *
return http.StatusOK, nil
}
-func getTreeHeadLatest(ctx context.Context, i *Instance, w http.ResponseWriter, _ *http.Request) (int, error) {
- glog.V(3).Info("handling get-tree-head-latest request")
- sth, err := i.Stateman.Latest(ctx)
- if err != nil {
- return http.StatusInternalServerError, err
- }
- if err := sth.ToASCII(w); err != nil {
- return http.StatusInternalServerError, err
- }
- return http.StatusOK, nil
-}
-
-func getTreeHeadToSign(ctx context.Context, i *Instance, w http.ResponseWriter, _ *http.Request) (int, error) {
+func getTreeHeadToCosign(ctx context.Context, i *Instance, w http.ResponseWriter, _ *http.Request) (int, error) {
glog.V(3).Info("handling get-tree-head-to-sign request")
- sth, err := i.Stateman.ToSign(ctx)
+ sth, err := i.Stateman.ToCosignTreeHead(ctx)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -105,7 +93,7 @@ func getTreeHeadToSign(ctx context.Context, i *Instance, w http.ResponseWriter,
func getTreeHeadCosigned(ctx context.Context, i *Instance, w http.ResponseWriter, _ *http.Request) (int, error) {
glog.V(3).Info("handling get-tree-head-cosigned request")
- cth, err := i.Stateman.Cosigned(ctx)
+ cth, err := i.Stateman.CosignedTreeHead(ctx)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -121,6 +109,7 @@ func getConsistencyProof(ctx context.Context, i *Instance, w http.ResponseWriter
if err != nil {
return http.StatusBadRequest, err
}
+ // XXX: check tree size of latest thing we signed?
proof, err := i.Client.GetConsistencyProof(ctx, req)
if err != nil {
@@ -138,6 +127,7 @@ func getInclusionProof(ctx context.Context, i *Instance, w http.ResponseWriter,
if err != nil {
return http.StatusBadRequest, err
}
+ // XXX: check tree size of latest thing we signed?
proof, err := i.Client.GetInclusionProof(ctx, req)
if err != nil {
@@ -155,6 +145,7 @@ func getLeaves(ctx context.Context, i *Instance, w http.ResponseWriter, r *http.
if err != nil {
return http.StatusBadRequest, err
}
+ // XXX: check tree size of latest thing we signed?
leaves, err := i.Client.GetLeaves(ctx, req)
if err != nil {