A Mean-Field Game Analysis of Consensus Protocol Design