You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
implement initial sync from latest block to genesis block #97
#88 has to be finished first
only do this in pair programming
blocks sync:
ask random peers about top and get top block of random peer(s) if we don't have it
for every block that we don't know the parent ask random peers for parent. Optional: mark block as "bad" if no-one can provide it's parent
for every block we get in i., ii.:
a. "single" validate transactions without chainstate, coinbase sum, version and root_hash(discard if invalid)
b. get parent if we don't have parent
for every "single" validated block that has not been "fully" validated:
a. if parent is not validate. Validate parent.
b. If parent does not exist skip.
c. validate the block
compare height of topmost block with chainstate height. If it's higher advance chainstate:
a. generate list of block between chainstate and highest block by traversing from top. If you find an marked as "invalid" block, mark all of it's children as invalid. (all blocks from top block to that block including top)
b. if you get to genesis while looking for chainstate block: regenerate chainstate from genesis. (We have to have some chainstate snapshots in future to avoid that)
c. validate blocks in order beginning with child of chainstate block. Update chainstate while doing that.
d. if validation fails at one point mark the block as "invalid" and mark all it's children as "invalid".
e. if validation failed at one point try again to get the topmost block and if it's not chainstate block try to advance chainstate as above described.
Activity
[GH-#97] Sync GenServer added; Get unknown blocks from peers
[GH-#97] Save unknown blocks from all peers to Sync state
[GH-#97] Function for updating block statuses
[GH-#97] Single validate all Sync state blocks
[GH-#97] Add unknown blocks to our chain
[GH-#97] Received broadcasted blocks are added to the Sync state and …
[GH-#97] Improved error handling
[GH-#97] Server responds with 404 if block isn't found, Sync worker r…
[GH-#97] Merge GH-97 with master and move Sync.Worker to Peers.Sync
[GH-#97] Removed unused module and changed function call in block_con…
[GH-#97] Fixed getting new peers
[GH-#97] Ask every newly added peer for his blocks
8 remaining items
[GH-#97] Added comments and fixed Sync.check_peer_block
[GH-#97] Blocks in the Sync module are now single validated before be…
[GH-97] Removed statuses from state
[GH-#97] Chain.has_block? added, Sync.check_peer_block refactored
[GH-#97] Sync state now stores block_hash => block instead of peer
[GH-#97] Now checking if we have broadcasted block in Chain before ad…
[GH-#97] Merged master
[GH-#97] Single validate blocks before adding to Sync state
[GH-#97] Checking peer block's hash
[GH-#97] Fixed conflicts after merging with master
[GH-#97] Added missing code in validate_block!
[GH-#97] Return state when block added to Sync is invalid
Merge pull request #126 from aeternity/GH-97
cytadela8 commentedon Nov 29, 2017
This was fixed by #126.