watchtower/wtserver: reject unknown blob types
This commit is contained in:
2 files changed
+27
No files matched your search
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/btcsuite/btcd/connmgr"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/watchtower/blob"
|
||||
"github.com/lightningnetwork/lnd/watchtower/wtdb"
|
||||
"github.com/lightningnetwork/lnd/watchtower/wtpolicy"
|
||||
"github.com/lightningnetwork/lnd/watchtower/wtwire"
|
||||
@@ -370,6 +371,15 @@ func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID,
|
||||
|
||||
rewardAddrBytes := rewardAddress.ScriptAddress()
|
||||
|
||||
// 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
|
||||
|
||||
Reference in new issue
Block a user