forked from axieinfinity/ronin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: fix inconsistent reorg behavior (axieinfinity#391)
* blockchain: fix inconsistent reorg behavior If the chain is reorganized because the newly submit block has higher justified block number, it can be reverted back to the old chain prior to reorg because the old blocks cause ErrKnownBlock during insertion via the insertChain method, which invokes writeKnownBlock to set the old chain as the canonical chain again. * consortium-v2: make the engine fully implement FastFinalityPoSA interface When testing, we may need to create the standalone consortium-v2 engine so we need to make it fully implement FastFinalityPoSA interface. * chain_makers: add GenerateConsortiumChain to genernate Consortium blocks When generating Consortium blocks, we need to modify the block after FinalizeAndAssemble to change the block signature in header's extra data. New function GenerateConsortiumChain adds a new parameter so the caller can pass a function to modify block after FinalizeAndAssemble. Besides, the fake chain reader also needs to return correct block header to be used by consensus engine in FinalizeAndAssemble. * consortium-v2: add unit test for known block reorg case --------- Co-authored-by: Bui Quang Minh <minh.bui@skymavis.com>
- Loading branch information
Showing
5 changed files
with
377 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.