diff --git a/watchtower/wtserver/create_session.go b/watchtower/wtserver/create_session.go index c60c9b18b..3fd58dbd2 100644 --- a/watchtower/wtserver/create_session.go +++ b/watchtower/wtserver/create_session.go @@ -54,6 +54,17 @@ func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID, ) } + // If the request asks for a reward session and the tower has them + // disabled, we will reject the request. + if s.cfg.DisableReward && req.BlobType.Has(blob.FlagReward) { + log.Debugf("Rejecting CreateSession from %s, reward "+ + "sessions disabled", id) + return s.replyCreateSession( + peer, id, wtwire.CreateSessionCodeRejectBlobType, 0, + 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 diff --git a/watchtower/wtserver/server.go b/watchtower/wtserver/server.go index 3b5cbc6be..1c46201bf 100644 --- a/watchtower/wtserver/server.go +++ b/watchtower/wtserver/server.go @@ -63,6 +63,10 @@ type Config struct { // NoAckUpdates causes the server to not acknowledge state updates, this // should only be used for testing. NoAckUpdates bool + + // DisableReward causes the server to reject any session creation + // attempts that request rewards. + DisableReward bool } // Server houses the state required to handle watchtower peers. It's primary job