-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting with implementation of sha256sum for block header and transa…
…ctions
- Loading branch information
1 parent
cd49954
commit f22304e
Showing
5 changed files
with
32 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
#![allow(dead_code, unused)] | ||
|
||
use super::block_header::BlockHeader; | ||
|
||
use crate::transactions::tx::{Tx}; | ||
|
||
#[derive(Debug)] | ||
struct Block{ | ||
block_header: BlockHeader, | ||
// TO DO: still need to define how we will represent the transactions in the block | ||
transactions: String | ||
transactions: Vec<Tx>, | ||
} | ||
|
||
impl Block { | ||
fn get_block_header_hash() -> String { | ||
String::from("Hello World!") | ||
} | ||
|
||
pub fn get_block_size(&self) -> u64 { | ||
let mut block_size: u64 = 0; | ||
for tx in &self.transactions{ | ||
block_size += tx.get_tx_size_in_bits(); | ||
} | ||
|
||
return block_size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters