Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
kep-1144 Dropping messages that do not have the correct swarm id
Browse files Browse the repository at this point in the history
  • Loading branch information
rnistuk authored and rnistuk committed Apr 17, 2019
1 parent dfbc949 commit 9e846a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ node::priv_protobuf_handler(const bzn_envelope& msg, std::shared_ptr<bzn::sessio
{
std::shared_lock<std::shared_mutex> lock(this->message_map_mutex); // lock for read access

if (msg.swarm_id() != this->options->get_swarm_id())
{
LOG(error) << "Dropping message with invalid swarm id: " << msg.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);
return;
}

if ((!msg.sender().empty()) && (!this->crypto->verify(msg)))
{
LOG(error) << "Dropping message with invalid signature: " << msg.ShortDebugString().substr(0, MAX_MESSAGE_SIZE);
Expand All @@ -148,7 +154,6 @@ node::priv_protobuf_handler(const bzn_envelope& msg, std::shared_ptr<bzn::sessio
{
LOG(debug) << "no handler for message type " << msg.payload_case();
}

}

void
Expand Down

0 comments on commit 9e846a4

Please sign in to comment.