This commit is contained in:
Michael Vines 2020-02-11 08:39:35 -07:00
parent 137577fb86
commit 4f2c76150f
3 changed files with 3 additions and 5 deletions

View File

@ -57,7 +57,7 @@ pub const MAX_TRANSACTION_FORWARDING_DELAY: usize = 6;
/// Converts a slot to a storage segment. Does not indicate that a segment is complete. /// Converts a slot to a storage segment. Does not indicate that a segment is complete.
pub fn get_segment_from_slot(rooted_slot: Slot, slots_per_segment: u64) -> Segment { pub fn get_segment_from_slot(rooted_slot: Slot, slots_per_segment: u64) -> Segment {
((rooted_slot + (slots_per_segment - 1)) / slots_per_segment) (rooted_slot + (slots_per_segment - 1)) / slots_per_segment
} }
/// Given a slot returns the latest complete segment, if no segment could possibly be complete /// Given a slot returns the latest complete segment, if no segment could possibly be complete

View File

@ -70,14 +70,14 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
let is_signer = { let is_signer = {
#[allow(clippy::cast_ptr_alignment)] #[allow(clippy::cast_ptr_alignment)]
let is_signer = *(input.add(offset) as *const u8); let is_signer = *(input.add(offset) as *const u8);
(is_signer != 0) is_signer != 0
}; };
offset += size_of::<u8>(); offset += size_of::<u8>();
let is_writable = { let is_writable = {
#[allow(clippy::cast_ptr_alignment)] #[allow(clippy::cast_ptr_alignment)]
let is_writable = *(input.add(offset) as *const u8); let is_writable = *(input.add(offset) as *const u8);
(is_writable != 0) is_writable != 0
}; };
offset += size_of::<u8>(); offset += size_of::<u8>();

View File

@ -1,6 +1,5 @@
//! The `hash` module provides functions for creating SHA-256 hashes. //! The `hash` module provides functions for creating SHA-256 hashes.
use bs58;
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
use std::{convert::TryFrom, fmt, mem, str::FromStr}; use std::{convert::TryFrom, fmt, mem, str::FromStr};
@ -97,7 +96,6 @@ pub fn extend_and_hash(id: &Hash, val: &[u8]) -> Hash {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use bs58;
#[test] #[test]
fn test_hash_fromstr() { fn test_hash_fromstr() {