-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(applying): check non-empty set of inputs
- Loading branch information
1 parent
9ee47a4
commit 81ebe3c
Showing
2 changed files
with
51 additions
and
7 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,15 +1,23 @@ | ||
//! Utilities required for Shelley-era transaction validation. | ||
use crate::types::{ShelleyProtParams, UTxOs, ValidationResult}; | ||
use crate::types::{ShelleyProtParams, UTxOs, ValidationError, ValidationResult}; | ||
|
||
use pallas_primitives::alonzo::MintedTx; | ||
use pallas_primitives::alonzo::{MintedTx, TransactionBody}; | ||
|
||
// TODO: implement each of the validation rules. | ||
pub fn validate_shelley_tx( | ||
_mtxp: &MintedTx, | ||
mtx: &MintedTx, | ||
_utxos: &UTxOs, | ||
_prot_pps: &ShelleyProtParams, | ||
_prot_magic: &u32, | ||
) -> ValidationResult { | ||
let tx_body: &TransactionBody = &mtx.transaction_body; | ||
check_ins_not_empty(tx_body) | ||
} | ||
|
||
fn check_ins_not_empty(tx_body: &TransactionBody) -> ValidationResult { | ||
if tx_body.inputs.is_empty() { | ||
return Err(ValidationError::TxInsEmpty); | ||
} | ||
Ok(()) | ||
} |
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