Skip to content

Commit

Permalink
refactor(transaction): add common getters to tramsaction
Browse files Browse the repository at this point in the history
  • Loading branch information
meship-starkware committed Aug 21, 2024
1 parent a57ad02 commit 110a23f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/blockifier/src/transaction/account_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ impl AccountTransaction {
Ok(())
}

pub fn transaction_hash(&self) -> &TransactionHash {
match self {
AccountTransaction::Invoke(tx) => &tx.tx_hash,
AccountTransaction::Declare(tx) => &tx.tx_hash,
AccountTransaction::DeployAccount(tx) => &tx.tx_hash,
}
}

fn check_fee_bounds(
&self,
tx_context: &TransactionContext,
Expand Down
7 changes: 7 additions & 0 deletions crates/blockifier/src/transaction/transaction_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ impl Transaction {
_ => unimplemented!(),
}
}

pub fn transaction_hash(tx: &Transaction) -> &TransactionHash {
match tx {
Transaction::AccountTransaction(tx) => tx.transaction_hash(),
Transaction::L1HandlerTransaction(tx) => &tx.tx_hash,
}
}
}

impl TransactionInfoCreator for Transaction {
Expand Down

0 comments on commit 110a23f

Please sign in to comment.