Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct { ID uint64 // incrementing ID of a sync Height uint64 // height at the moment when State is requested for a sync FromHeight, ToHeight uint64 // the starting and the ending point of a sync FromHash, ToHash tmbytes.HexBytes Start, End time.Time Error error // the error that might happen within a sync }
State collects all the information about a sync.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer implements efficient synchronization for headers.
There are two main processes running in Syncer: 1. Main syncing loop(s.syncLoop)
- Performs syncing from the subjective(local chain view) header up to the latest known trusted header
- Syncs by requesting missing headers from Exchange or
- By accessing cache of pending and verified headers
2. Receives new headers from PubSub subnetwork (s.processIncoming)
- Usually, a new header is adjacent to the trusted head and if so, it is simply appended to the local store, incrementing the subjective height and making it the new latest known trusted header.
- Or, if it receives a header further in the future,
- verifies against the latest known trusted header
- adds the header to pending cache(making it the latest known trusted header)
- and triggers syncing loop to catch up to that point.
Click to show internal directories.
Click to hide internal directories.