Blockchain Security: Consensus Safety

PBFT-style view change sketch.

if timeout and no quorum:
  view = view + 1
  broadcast(NEW_VIEW, view)
  collect PREPARE from 2f peers to commit

And a tiny Go snippet for quorum check:

func hasQuorum(n, f, votes int) bool {
    return votes >= 2*f+1 && n >= 3*f+1
}