Fix BlocksByRootRequest min/max bounds calculation (#1312)

This commit is contained in:
Pawan Dhananjay 2020-06-29 16:33:14 +05:30 committed by GitHub
parent 2ccb9f48da
commit d4dd9fae07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -188,7 +188,7 @@ pub struct BlocksByRangeRequest {
} }
/// Request a number of beacon block bodies from a peer. /// Request a number of beacon block bodies from a peer.
#[derive(Encode, Decode, Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct BlocksByRootRequest { pub struct BlocksByRootRequest {
/// The list of beacon block bodies being requested. /// The list of beacon block bodies being requested.
pub block_roots: VariableList<Hash256, MaxRequestBlocks>, pub block_roots: VariableList<Hash256, MaxRequestBlocks>,

View File

@ -43,18 +43,16 @@ lazy_static! {
} }
.as_ssz_bytes() .as_ssz_bytes()
.len(); .len();
pub static ref BLOCKS_BY_ROOT_REQUEST_MIN: usize = BlocksByRootRequest { pub static ref BLOCKS_BY_ROOT_REQUEST_MIN: usize =
block_roots: VariableList::<Hash256, MaxRequestBlocks>::from(Vec::<Hash256>::new()) VariableList::<Hash256, MaxRequestBlocks>::from(Vec::<Hash256>::new())
}
.as_ssz_bytes() .as_ssz_bytes()
.len(); .len();
pub static ref BLOCKS_BY_ROOT_REQUEST_MAX: usize = BlocksByRootRequest { pub static ref BLOCKS_BY_ROOT_REQUEST_MAX: usize =
block_roots: VariableList::<Hash256, MaxRequestBlocks>::from(vec![ VariableList::<Hash256, MaxRequestBlocks>::from(vec![
Hash256::zero(); Hash256::zero();
MAX_REQUEST_BLOCKS MAX_REQUEST_BLOCKS
as usize as usize
]) ])
}
.as_ssz_bytes() .as_ssz_bytes()
.len(); .len();
} }