Skip to content

Commit

Permalink
transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
YeahNotSewerSide committed Jul 2, 2024
1 parent 26554b1 commit d4c0977
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ pub trait Block {
fn get_fee(&self) -> U256;
fn get_type(&self) -> Headers;
fn validate(&self, prev_block: Option<BlockArc>) -> Result<bool, BlockError>;
fn transactions(&self) -> Option<&[Hash]>;
}

impl Block for DerivativeBlock {
Expand Down Expand Up @@ -325,6 +326,10 @@ impl Block for DerivativeBlock {

Ok(true)
}

fn transactions<'a>(&'a self) -> Option<&'a [Hash]> {
None
}
}

impl DerivativeBlock {
Expand Down Expand Up @@ -415,6 +420,10 @@ impl Block for TransactionBlock {

Ok(true)
}

fn transactions<'a>(&'a self) -> Option<&'a [Hash]> {
Some(&self.transactions)
}
}

#[derive(Debug)]
Expand Down Expand Up @@ -546,6 +555,10 @@ impl Block for SummarizeBlock {

Ok(true)
}

fn transactions(&self) -> Option<&[Hash]> {
None
}
}

/// Deserializes block's dump into BlockArc
Expand Down

0 comments on commit d4c0977

Please sign in to comment.