| layout | post |
|---|---|
| permalink | /how-to-sync-blocks-with-validators/ |
BOOTING- The node is on start but not ready to consensus or sync.CONSENSUS- The node has all blocks and ready to proceed consensus.SYNC- The node is not ready for consensus because in sync.WATCH- The node watches it's validators and try to sync. This node does not participate in the consensus.
BOOTING->CONSENSUSThe status changes fromBOOTINGtoCONSENSUSwhen node running and a sufficient number of validator nodes are connected.CONSENSUS->SYNCThe node state changes fromCONSENSUStoSYNCwhen its block height is lower than the agreed block height through voting.- A node receives
ACCEPTandYESballots only. - When the number of ballots exceeds the threshold,
- And when the height of this agreed ballot is different with
Last Confirmed Height + 1. - The status changes from
CONSENSUStoSYNC.
- A node receives
SYNC->CONSENSUSThe status changes fromSYNCtoCONSENSUSin case of,- The node is in same height and round with the other validators.
- The node has all blocks, transactions and operations.
- All blocks the node has are valid.
- The node agrees on the proposer's proposing block and save it.
WATCHThe node sets as a watcher is alwaysWATCHstate. It does not change to another node state.
- In
BallotCheckSYNCmethod, a node receives B(ACCEPT,YES) only. - When a node receives the ballots based same height
hand round from greater than or equal to 67% validators, it asks validators for blocks up toh. - But in this timing, the other nodes confirms the new block with
h+1because it also receives enough B(ACCEPT,YES). - Therefore, a node saves ballot with
hlike cache, then in next height it saves two blocks(handh+1) at the same time.
- There are 4 nodes(
A,B,C,D) and threshold is 3. And B(ACCEPT,YES, 10) means a ballot withACCEPTstate ,YESvote and based height 10.A,B,Care in height 10, butDis in height 5 yet.A,B,Ckeep voting next height soDreceives three B(ACCEPT,YES, 10) from them.Drequests the block up to 10 to the validators and save B(ACCEPT,YES, 10) as a cache.- In next height,
Dreceives three B(ACCEPT,YES, 11) from validators as above. - The node confirms two blocks based on the ballots
- Based on B(
ACCEPT,YES, 10),Dconfirms the block with height 11. - Based on B(
ACCEPT,YES, 11),Dconfirms the block with height 12.
- Based on B(
- It can be participate in consensus voting from 13 height.