From 999cbbdc54a87f3b25ae0f94c68ae583855076bc Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 23 Apr 2019 20:05:12 -0700 Subject: [PATCH] watchtower/wtserver/server: check blob type first --- watchtower/wtserver/create_session.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/watchtower/wtserver/create_session.go b/watchtower/wtserver/create_session.go index e948d8b9a..f00af392b 100644 --- a/watchtower/wtserver/create_session.go +++ b/watchtower/wtserver/create_session.go @@ -40,6 +40,15 @@ func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID, ) } + // Ensure that the requested blob type is supported by our tower. + if !blob.IsSupportedType(req.BlobType) { + log.Debugf("Rejecting CreateSession from %s, unsupported blob "+ + "type %s", id, req.BlobType) + return s.replyCreateSession( + peer, id, wtwire.CreateSessionCodeRejectBlobType, nil, + ) + } + // Now that we've established that this session does not exist in the // database, retrieve the sweep address that will be given to the // client. This address is to be included by the client when signing @@ -63,15 +72,6 @@ func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID, ) } - // Ensure that the requested blob type is supported by our tower. - if !blob.IsSupportedType(req.BlobType) { - log.Debugf("Rejecting CreateSession from %s, unsupported blob "+ - "type %s", id, req.BlobType) - return s.replyCreateSession( - peer, id, wtwire.CreateSessionCodeRejectBlobType, nil, - ) - } - // TODO(conner): create invoice for upfront payment // Assemble the session info using the agreed upon parameters, reward