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

Commit

Permalink
KEP-915 Status response should be within a bzn_envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruck committed Dec 17, 2018
1 parent 46f7543 commit 472e6fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions proto/bluzelle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message bzn_envelope
bytes pbft = 15;
bytes pbft_membership = 16;
bytes status_request = 17;
bytes status_response = 18;
}
}

Expand Down
7 changes: 6 additions & 1 deletion status/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,10 @@ status::handle_status_request_message(const bzn_envelope& /*msg*/, std::shared_p

LOG(debug) << srm.DebugString().substr(0, MAX_MESSAGE_SIZE);

session->send_message(std::make_shared<bzn::encoded_message>(srm.SerializeAsString()), false);
bzn_envelope env;
env.set_status_response(srm.SerializeAsString());
env.set_sender("placeholder for daemon's uuid"); // TODO
// TODO: crypto

session->send_message(std::make_shared<bzn::encoded_message>(env.SerializeAsString()), false);
}
8 changes: 6 additions & 2 deletions status/test/status_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ TEST(status_test, test_that_status_request_queries_status_providers)
EXPECT_CALL(*mock_session, send_message(An<std::shared_ptr<bzn::encoded_message>>(), false)).WillOnce(Invoke(
[&](std::shared_ptr<bzn::encoded_message> msg, bool)
{
status_response sr;
bzn_envelope env;

ASSERT_TRUE(env.ParseFromString(*msg));
ASSERT_EQ(env.payload_case(), bzn_envelope::kStatusResponse);

ASSERT_TRUE(sr.ParseFromString(*msg));
status_response sr;
ASSERT_TRUE(sr.ParseFromString(env.status_response()));
ASSERT_TRUE(sr.pbft_enabled());
ASSERT_EQ(sr.swarm_version(), SWARM_VERSION);
ASSERT_EQ(sr.swarm_git_commit(), SWARM_GIT_COMMIT);
Expand Down

0 comments on commit 472e6fd

Please sign in to comment.