watchtower/wtserver/server: check blob type first
This commit is contained in:
parent
bebe6461a9
commit
999cbbdc54
@ -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
|
// Now that we've established that this session does not exist in the
|
||||||
// database, retrieve the sweep address that will be given to the
|
// database, retrieve the sweep address that will be given to the
|
||||||
// client. This address is to be included by the client when signing
|
// 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
|
// TODO(conner): create invoice for upfront payment
|
||||||
|
|
||||||
// Assemble the session info using the agreed upon parameters, reward
|
// Assemble the session info using the agreed upon parameters, reward
|
||||||
|
Loading…
Reference in New Issue
Block a user