An Optimal Solution for Consensus Problem in an Unreliable Communications System