Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
attempt to understand entry
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-solana committed Jun 18, 2018
1 parent 92599ac commit 1e1a0b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ fn add_transaction_data(hash_data: &mut Vec<u8>, tx: &Transaction) {

/// Creates the hash `num_hashes` after `start_hash`. If the transaction contains
/// a signature, the final hash will be a hash of both the previous ID and
/// the signature.
/// the signature. If num_hashes is zero and there's no transaction data,
// start_hash is returned.
pub fn next_hash(start_hash: &Hash, num_hashes: u64, transactions: &[Transaction]) -> Hash {
let mut id = *start_hash;
for _ in 1..num_hashes {
Expand Down Expand Up @@ -174,5 +175,10 @@ mod tests {
let tick = next_entry(&zero, 1, vec![]);
assert_eq!(tick.num_hashes, 1);
assert_ne!(tick.id, zero);

let tick = next_entry(&zero, 0, vec![]);
assert_eq!(tick.num_hashes, 0);
assert_eq!(tick.id, zero);

}
}

0 comments on commit 1e1a0b5

Please sign in to comment.