Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

[DRAFT] Add bootstrap handling#136

Draft
gurghet wants to merge 6 commits intofeeless:mainfrom
gurghet:add-bootstrap-handling
Draft

[DRAFT] Add bootstrap handling#136
gurghet wants to merge 6 commits intofeeless:mainfrom
gurghet:add-bootstrap-handling

Conversation

@gurghet
Copy link
Contributor

@gurghet gurghet commented Aug 6, 2021

This adds bootstrap handling in a built-in way.
I'm publishing this as a draft PR as I'm not sure this should be merged (wanted to build a dedicated module for bootstrap) but I don't want to lose track of the progress so far.


impl SendBlock {
pub const LEN: usize = 152;
pub const LEN: usize = 32+32+16+64+8;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is never going to change, true, but I think it's clearer like this, each field its own number.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

debug_assert!(header.is_some());
let header = header.unwrap();
debug_assert_eq!(header.ext().block_type()?, BlockType::State);
if let Some(header) = header {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be without header in the bulk pull case

) -> anyhow::Result<()> {
// The rest of this connection will be a bunch of blocks without any headers.
if matches!(self.bootstrap_state, FrontierStream) {
panic!("Invalid bootstrap state transition FrontierStream => BulkPull");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably planned, but just suggesting this be an Err because a peer can trigger this, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I'm moving stuff around right now. Could you elaborate anyways? I used panic because I thought this should be an irrecoverable programming error, the transition should not be even possible.

gurghet added 3 commits August 8, 2021 12:54
This is only so save progress. I was trying different things but I
think I will settle for the uncommented code. Just need some time to
clean it all up, give proper names to functions, and maybe refactor
a few things.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants