Skip to content

Commit

Permalink
Merge branch 'feature/consensus-locks' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
muratovv committed Aug 30, 2017
2 parents 8fe822f + c3185cb commit 5533db8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions irohad/consensus/yac/impl/yac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,21 @@ namespace iroha {
// ------|Network notifications|------

void Yac::on_vote(model::Peer from, VoteMessage vote) {
std::lock_guard<std::mutex> guard(mutex_);
if (crypto_->verify(vote)) {
this->applyVote(from, vote);
}
}

void Yac::on_commit(model::Peer from, CommitMessage commit) {
std::lock_guard<std::mutex> guard(mutex_);
if (crypto_->verify(commit)) {
this->applyCommit(from, commit);
}
}

void Yac::on_reject(model::Peer from, RejectMessage reject) {
std::lock_guard<std::mutex> guard(mutex_);
if (crypto_->verify(reject)) {
this->applyReject(from, reject);
}
Expand Down
2 changes: 2 additions & 0 deletions irohad/consensus/yac/yac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <mutex>
#include <nonstd/optional.hpp>

#include "consensus/yac/yac_gate.hpp"
Expand Down Expand Up @@ -101,6 +102,7 @@ namespace iroha {
std::shared_ptr<YacCryptoProvider> crypto_;
std::shared_ptr<Timer> timer_;
rxcpp::subjects::subject<CommitMessage> notifier_;
std::mutex mutex_;

// ------|One round|------
ClusterOrdering cluster_order_;
Expand Down

0 comments on commit 5533db8

Please sign in to comment.