You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.8 KiB

  1. ---
  2. order: 10
  3. ---
  4. # Block Sync
  5. *Formerly known as Fast Sync*
  6. In a proof of work blockchain, syncing with the chain is the same
  7. process as staying up-to-date with the consensus: download blocks, and
  8. look for the one with the most total work. In proof-of-stake, the
  9. consensus process is more complex, as it involves rounds of
  10. communication between the nodes to determine what block should be
  11. committed next. Using this process to sync up with the blockchain from
  12. scratch can take a very long time. It's much faster to just download
  13. blocks and check the merkle tree of validators than to run the real-time
  14. consensus gossip protocol.
  15. ## Using Block Sync
  16. To support faster syncing, Tendermint offers a `blocksync` mode, which
  17. is enabled by default, and can be toggled in the `config.toml` or via
  18. `--blocksync.enable=false`.
  19. In this mode, the Tendermint daemon will sync hundreds of times faster
  20. than if it used the real-time consensus process. Once caught up, the
  21. daemon will switch out of Block Sync and into the normal consensus mode.
  22. After running for some time, the node is considered `caught up` if it
  23. has at least one peer and it's height is at least as high as the max
  24. reported peer height. See [the IsCaughtUp
  25. method](https://github.com/tendermint/tendermint/blob/b467515719e686e4678e6da4e102f32a491b85a0/blockchain/pool.go#L128).
  26. Note: There are multiple versions of Block Sync. Please use v0 as the other versions are no longer supported.
  27. If you would like to use a different version you can do so by changing the version in the `config.toml`:
  28. ```toml
  29. #######################################################
  30. ### Block Sync Configuration Connections ###
  31. #######################################################
  32. [blocksync]
  33. # If this node is many blocks behind the tip of the chain, BlockSync
  34. # allows them to catchup quickly by downloading blocks in parallel
  35. # and verifying their commits
  36. enable = true
  37. # Block Sync version to use:
  38. # 1) "v0" (default) - the standard Block Sync implementation
  39. # 2) "v2" - DEPRECATED, please use v0
  40. version = "v0"
  41. ```
  42. If we're lagging sufficiently, we should go back to block syncing, but
  43. this is an [open issue](https://github.com/tendermint/tendermint/issues/129).
  44. ## The Block Sync event
  45. When the tendermint blockchain core launches, it might switch to the `block-sync`
  46. mode to catch up the states to the current network best height. the core will emits
  47. a fast-sync event to expose the current status and the sync height. Once it catched
  48. the network best height, it will switches to the state sync mechanism and then emit
  49. another event for exposing the fast-sync `complete` status and the state `height`.
  50. The user can query the events by subscribing `EventQueryBlockSyncStatus`
  51. Please check [types](https://pkg.go.dev/github.com/tendermint/tendermint/types?utm_source=godoc#pkg-constants) for the details.