Clean up comments: Event -> Transaction
This commit is contained in:
parent
74c479fbc9
commit
f1075191fe
|
@ -100,7 +100,7 @@ impl BankingStage {
|
||||||
debug!("process_transactions");
|
debug!("process_transactions");
|
||||||
let results = bank.process_transactions(transactions);
|
let results = bank.process_transactions(transactions);
|
||||||
let transactions = results.into_iter().filter_map(|x| x.ok()).collect();
|
let transactions = results.into_iter().filter_map(|x| x.ok()).collect();
|
||||||
signal_sender.send(Signal::Events(transactions))?;
|
signal_sender.send(Signal::Transactions(transactions))?;
|
||||||
debug!("done process_transactions");
|
debug!("done process_transactions");
|
||||||
|
|
||||||
packet_recycler.recycle(msgs);
|
packet_recycler.recycle(msgs);
|
||||||
|
@ -293,7 +293,7 @@ mod bench {
|
||||||
&packet_recycler,
|
&packet_recycler,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let signal = signal_receiver.recv().unwrap();
|
let signal = signal_receiver.recv().unwrap();
|
||||||
if let Signal::Events(transactions) = signal {
|
if let Signal::Transactions(transactions) = signal {
|
||||||
assert_eq!(transactions.len(), tx);
|
assert_eq!(transactions.len(), tx);
|
||||||
} else {
|
} else {
|
||||||
assert!(false);
|
assert!(false);
|
||||||
|
|
|
@ -9,7 +9,7 @@ use transaction::Transaction;
|
||||||
/// Each Entry contains three pieces of data. The `num_hashes` field is the number
|
/// Each Entry contains three pieces of data. The `num_hashes` field is the number
|
||||||
/// of hashes performed since the previous entry. The `id` field is the result
|
/// of hashes performed since the previous entry. The `id` field is the result
|
||||||
/// of hashing `id` from the previous entry `num_hashes` times. The `transactions`
|
/// of hashing `id` from the previous entry `num_hashes` times. The `transactions`
|
||||||
/// field points to Events that took place shortly after `id` was generated.
|
/// field points to Transactions that took place shortly after `id` was generated.
|
||||||
///
|
///
|
||||||
/// If you divide `num_hashes` by the amount of time it takes to generate a new hash, you
|
/// If you divide `num_hashes` by the amount of time it takes to generate a new hash, you
|
||||||
/// get a duration estimate since the last Entry. Since processing power increases
|
/// get a duration estimate since the last Entry. Since processing power increases
|
||||||
|
@ -95,7 +95,7 @@ pub fn next_hash(start_hash: &Hash, num_hashes: u64, transactions: &[Transaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the next Tick or Event Entry `num_hashes` after `start_hash`.
|
/// Creates the next Tick or Transaction Entry `num_hashes` after `start_hash`.
|
||||||
pub fn next_entry(start_hash: &Hash, num_hashes: u64, transactions: Vec<Transaction>) -> Entry {
|
pub fn next_entry(start_hash: &Hash, num_hashes: u64, transactions: Vec<Transaction>) -> Entry {
|
||||||
Entry {
|
Entry {
|
||||||
num_hashes,
|
num_hashes,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//! The `record_stage` module provides an object for generating a Proof of History.
|
//! The `record_stage` module provides an object for generating a Proof of History.
|
||||||
//! It records Event items on behalf of its users. It continuously generates
|
//! It records Transaction items on behalf of its users. It continuously generates
|
||||||
//! new hashes, only stopping to check if it has been sent an Event item. It
|
//! new hashes, only stopping to check if it has been sent an Transaction item. It
|
||||||
//! tags each Event with an Entry, and sends it back. The Entry includes the
|
//! tags each Transaction with an Entry, and sends it back. The Entry includes the
|
||||||
//! Event, the latest hash, and the number of hashes since the last transaction.
|
//! Transaction, the latest hash, and the number of hashes since the last transaction.
|
||||||
//! The resulting stream of entries represents ordered transactions in time.
|
//! The resulting stream of entries represents ordered transactions in time.
|
||||||
|
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
|
@ -16,7 +16,7 @@ use transaction::Transaction;
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||||
pub enum Signal {
|
pub enum Signal {
|
||||||
Tick,
|
Tick,
|
||||||
Events(Vec<Transaction>),
|
Transactions(Vec<Transaction>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RecordStage {
|
pub struct RecordStage {
|
||||||
|
@ -25,7 +25,7 @@ pub struct RecordStage {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RecordStage {
|
impl RecordStage {
|
||||||
/// A background thread that will continue tagging received Event messages and
|
/// A background thread that will continue tagging received Transaction messages and
|
||||||
/// sending back Entry messages until either the receiver or sender channel is closed.
|
/// sending back Entry messages until either the receiver or sender channel is closed.
|
||||||
pub fn new(signal_receiver: Receiver<Signal>, start_hash: &Hash) -> Self {
|
pub fn new(signal_receiver: Receiver<Signal>, start_hash: &Hash) -> Self {
|
||||||
let (entry_sender, entry_receiver) = channel();
|
let (entry_sender, entry_receiver) = channel();
|
||||||
|
@ -85,7 +85,7 @@ impl RecordStage {
|
||||||
recorder: &mut Recorder,
|
recorder: &mut Recorder,
|
||||||
sender: &Sender<Entry>,
|
sender: &Sender<Entry>,
|
||||||
) -> Result<(), ()> {
|
) -> Result<(), ()> {
|
||||||
let txs = if let Signal::Events(txs) = signal {
|
let txs = if let Signal::Transactions(txs) = signal {
|
||||||
txs
|
txs
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
|
@ -180,7 +180,9 @@ mod tests {
|
||||||
let bob_pubkey = KeyPair::new().pubkey();
|
let bob_pubkey = KeyPair::new().pubkey();
|
||||||
let tx0 = Transaction::new(&alice_keypair, bob_pubkey, 1, zero);
|
let tx0 = Transaction::new(&alice_keypair, bob_pubkey, 1, zero);
|
||||||
let tx1 = Transaction::new(&alice_keypair, bob_pubkey, 2, zero);
|
let tx1 = Transaction::new(&alice_keypair, bob_pubkey, 2, zero);
|
||||||
tx_sender.send(Signal::Events(vec![tx0, tx1])).unwrap();
|
tx_sender
|
||||||
|
.send(Signal::Transactions(vec![tx0, tx1]))
|
||||||
|
.unwrap();
|
||||||
drop(tx_sender);
|
drop(tx_sender);
|
||||||
let entries: Vec<_> = record_stage.entry_receiver.iter().collect();
|
let entries: Vec<_> = record_stage.entry_receiver.iter().collect();
|
||||||
assert_eq!(entries.len(), 1);
|
assert_eq!(entries.len(), 1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//! The `recorder` module provides an object for generating a Proof of History.
|
//! The `recorder` module provides an object for generating a Proof of History.
|
||||||
//! It records Event items on behalf of its users.
|
//! It records Transaction items on behalf of its users.
|
||||||
|
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use hash::{hash, Hash};
|
use hash::{hash, Hash};
|
||||||
|
|
Loading…
Reference in New Issue