* move masternode in v2 config
* update number to meet 7 vote for current setup
* add test
* update all failed test
* fix test
* remove comment
* remove comment
* fix test
This PR makes committed blocks non-reorg-able inside `Blockchain` struct. This ensures V2 consensus safety property in the aspect of blockchain head: committed blocks' state will not be reorg and users will always see committed blocks (or their child blocks) as current head of the blockchain.
* stop reorg at committed blocks
* fix tests
* fix tests
* V2 truncate MaxMasternodes from candidates after penalty,
V1 same as before
TestUpdateMultipleMasterNodes: test V2, in snapshot we have all candidates, but at epoch switch, we pick MaxMasternodes
* code looks better
* Fix issue when resync is not getting the right consensus config values
* add test and fix log bug
* fix test
* delete temp file
Co-authored-by: Liam Lai <liam.icheng.lai@gmail.com>
* update forensics proof data structure to accomedate vote type
* refactor log
* change blocknum type to uint64
* fix test
Co-authored-by: Liam Lai <liam.icheng.lai@gmail.com>
* process forensics
* Found common signers at same round for forensics
* find attackers
* add test for forensics
* run setCommittedQCs after processForensics
* clean up the pool old round
* add unit test to cover the vote key format
* add gapNumber to the vote pool key
* fix race condition in pool
* remove verify gap number in vote handler
* typo and checkYourturnWithinFinalisedMasternodes func name to yourturn
* remove redundant code from verifyQC
* Verify QC to optionally pass parent header. This is used to help verifyHeaders
* move difficulty into its own file
* verify header including validator
* re-structure v1 v2 tests
* remove unused test function
* add test to check coinbase and validator address matches
* refactor engine v2 to group private functions into same file