Skip to content

Refactor BodyDownloader#116

Merged
sgkim126 merged 5 commits intoCodeChain-io:masterfrom
sgkim126:body-downloader
Feb 16, 2020
Merged

Refactor BodyDownloader#116
sgkim126 merged 5 commits intoCodeChain-io:masterfrom
sgkim126:body-downloader

Conversation

@sgkim126
Copy link
Contributor

There are five states for block hashes.

  1. listed, but no request sent
  2. sent the request
  3. received the response
  4. drained from the list
  5. imported on the chain

Currently, these states are implicit with the combination of targets, downloading, and downloaded fields.
This patch merges downloading and downloaded fields, and make the states explicit.
There are four explicit states. The 5th state does not exist in BodyDownloader because it doesn't care about the imported blocks.

@sgkim126 sgkim126 added the refactoring Behavior does not change. Make code simple label Jan 26, 2020
@majecty majecty added the do-not-merge Do not merge this PR label Jan 30, 2020
@sgkim126 sgkim126 force-pushed the body-downloader branch 2 times, most recently from 9f2b596 to 6bbc90a Compare February 6, 2020 04:49
@sgkim126 sgkim126 requested a review from majecty February 6, 2020 04:50
@sgkim126 sgkim126 changed the title [wip] Refactor BodyDownloader Refactor BodyDownloader Feb 6, 2020
@sgkim126 sgkim126 removed the do-not-merge Do not merge this PR label Feb 6, 2020
Once we introduce the CloseBlock transaction, there will be no empty
block.
There are 5 states for block hashes.
1. listed, but no request sent
2. sent the request
3. received the response
4. drained from the list
5. imported on the chain

Currently, these states are implicit with the combination of targets,
downloading, and downloaded fields.
This patch merges downloading and downloaded fields, and make the states
explicit.
@sgkim126 sgkim126 merged commit 7a0339a into CodeChain-io:master Feb 16, 2020
@sgkim126 sgkim126 deleted the body-downloader branch February 16, 2020 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Behavior does not change. Make code simple

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants