Rename Block to EntrySlice

This commit is contained in:
Stephen Akridge 2019-01-09 13:34:41 -08:00 committed by sakridge
parent 045c5e8556
commit ebd676faaa
11 changed files with 15 additions and 13 deletions

View File

@ -6,7 +6,9 @@ extern crate test;
use rand::seq::SliceRandom;
use rand::{thread_rng, Rng};
use solana::db_ledger::DbLedger;
use solana::ledger::{get_tmp_ledger_path, make_large_test_entries, make_tiny_test_entries, Block};
use solana::ledger::{
get_tmp_ledger_path, make_large_test_entries, make_tiny_test_entries, EntrySlice,
};
use solana::packet::{Blob, BLOB_HEADER_SIZE};
use test::Bencher;

View File

@ -3,7 +3,7 @@
extern crate test;
use solana::entry::reconstruct_entries_from_blobs;
use solana::ledger::{next_entries, Block};
use solana::ledger::{next_entries, EntrySlice};
use solana_sdk::hash::{hash, Hash};
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_transaction::SystemTransaction;

View File

@ -9,7 +9,7 @@ use crate::counter::Counter;
use crate::entry::Entry;
use crate::jsonrpc_macros::pubsub::Sink;
use crate::leader_scheduler::LeaderScheduler;
use crate::ledger::Block;
use crate::ledger::EntrySlice;
use crate::mint::Mint;
use crate::poh_recorder::PohRecorder;
use crate::rpc::RpcSignatureStatus;

View File

@ -268,7 +268,7 @@ mod tests {
use super::*;
use crate::bank::Bank;
use crate::banking_stage::BankingStageReturnType;
use crate::ledger::Block;
use crate::ledger::EntrySlice;
use crate::mint::Mint;
use crate::packet::to_packets;
use solana_sdk::signature::{Keypair, KeypairUtil};

View File

@ -8,7 +8,7 @@ use crate::entry::Entry;
#[cfg(feature = "erasure")]
use crate::erasure;
use crate::leader_scheduler::LeaderScheduler;
use crate::ledger::Block;
use crate::ledger::EntrySlice;
use crate::packet::{index_blobs, SharedBlob};
use crate::result::{Error, Result};
use crate::service::Service;

View File

@ -843,7 +843,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block};
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, EntrySlice};
use crate::packet::index_blobs;
#[test]

View File

@ -301,7 +301,7 @@ mod test {
use crate::erasure::test::{generate_db_ledger_from_window, setup_window_ledger};
#[cfg(all(feature = "erasure", test))]
use crate::erasure::{NUM_CODING, NUM_DATA};
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block};
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, EntrySlice};
use crate::packet::{index_blobs, Blob, Packet, Packets, SharedBlob, PACKET_DATA_SIZE};
use crate::streamer::{receiver, responder, PacketReceiver};
use solana_sdk::signature::{Keypair, KeypairUtil};

View File

@ -549,7 +549,7 @@ fn categorize_blob(
pub mod test {
use super::*;
use crate::db_ledger::{DbLedger, DEFAULT_SLOT_HEIGHT};
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block};
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, EntrySlice};
use crate::packet::{index_blobs, SharedBlob, BLOB_DATA_SIZE, BLOB_SIZE};
use crate::window::WindowSlot;

View File

@ -18,8 +18,8 @@ use solana_sdk::vote_program::Vote;
use solana_sdk::vote_transaction::VoteTransaction;
use std::fs::remove_dir_all;
// a Block is a slice of Entries
pub trait Block {
// an EntrySlice is a slice of Entries
pub trait EntrySlice {
/// Verifies the hashes and counts of a slice of transactions are all consistent.
fn verify(&self, start_hash: &Hash) -> bool;
fn to_shared_blobs(&self) -> Vec<SharedBlob>;
@ -27,7 +27,7 @@ pub trait Block {
fn votes(&self) -> Vec<(Pubkey, Vote, Hash)>;
}
impl Block for [Entry] {
impl EntrySlice for [Entry] {
fn verify(&self, start_hash: &Hash) -> bool {
let genesis = [Entry {
tick_height: 0,

View File

@ -103,7 +103,7 @@ impl Mint {
#[cfg(test)]
mod tests {
use super::*;
use crate::ledger::Block;
use crate::ledger::EntrySlice;
use bincode::deserialize;
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_program;

View File

@ -6,7 +6,7 @@ use crate::counter::Counter;
use crate::entry::{EntryReceiver, EntrySender};
use solana_sdk::hash::Hash;
use crate::ledger::Block;
use crate::ledger::EntrySlice;
use crate::packet::BlobError;
use crate::result::{Error, Result};
use crate::rpc_request::RpcClient;