Incorrect ViewChange messages consensus calculating
The simulation test for ViewChange sometimes fails
https://github.com/hyperledger/indy-plenum/blob/c10090d8f7f3ffcae84f7d8f6df3e30517000270/plenum/test/consensus/view_change/test_sim_view_change.py#L65
because of problem with getting a checkpoint on the phase of collecting ViewChange messages in the method calc_checkpoint(). It receives a list of ViewChange messages like a parameter.
If it's a 4 node pool and the list contains the follow ViewChange messages
- ViewChange_1 | checkpoints_ends: 10, 20 | stable_checkpoint: 10
- ViewChange_2 | checkpoints_ends: 0, 10 | stable_checkpoint: 0
- ViewChange_2 | checkpoints_ends: 0 | stable_checkpoint: 0
Then we don't have a strong consensus of 3 (n-f=4-1) checkpoins with the same checkpoint end. It means, that the node can't finish a view change.
Expected problem: Low probability one or more nodes may not finish View Change and after a short period just start a new one.
With an incredibly low probability a pool can freeze with endless view changes. But it can be fixed by POOL_RESTART transaction.
We don’t think we have a big chance to face this case. But we need to remember about it and fix.
When addressing this issue, please ensure any workarounds such as this are addressed; https://github.com/hyperledger/indy-plenum/blob/705582e2657433a7d907f0d390fd885b11554736/plenum/test/consensus/view_change/test_sim_view_change.py#L90-L92