Skip to content

Commit 9995ed0

Browse files
committed
chore: address pr feedback
Signed-off-by: yHSJ <[email protected]>
1 parent 61c80b0 commit 9995ed0

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

crates/amaru-ledger/src/rules.rs

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ pub fn validate_block(
9494
None => Vec::new(),
9595
};
9696

97+
// using `zip` here instead of enumerate as it is safer to cast from usize to u32 than u32 to usize
98+
// Realistically, we're never gonna hit the u32 limit with the number of transactions in a block (a boy can dream)
9799
for (i, (transaction, raw_transaction)) in
98100
(0u32..).zip(transactions.iter().zip(raw_transactions))
99101
{

crates/amaru-ledger/src/rules/transaction/disjoint_ref_inputs.rs

-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ impl Into<TransactionRuleViolation> for NonDisjointRefInputs {
1212
}
1313
}
1414

15-
// impl From<NonDisjointRefInputs> for TransactionRuleViolation {
16-
// fn from(value: NonDisjointRefInputs) -> Self {
17-
// TransactionRuleViolation::NonDisjointRefInputs(value)
18-
// }
19-
// }
20-
2115
pub fn disjoint_ref_inputs(transaction: &TransactionBody) -> Result<(), NonDisjointRefInputs> {
2216
let intersection = match &transaction.reference_inputs {
2317
Some(ref_inputs) => ref_inputs

crates/amaru-ledger/src/rules/transaction/output_size.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use amaru_kernel::{
66
use crate::rules::TransactionRuleViolation;
77

88
pub struct OutputTooSmall {
9-
pub outputs_too_small: Vec<TransactionOutput>,
9+
pub outputs_too_small: Vec<&TransactionOutput>,
1010
}
1111

1212
impl Into<TransactionRuleViolation> for OutputTooSmall {
@@ -22,9 +22,8 @@ pub fn validate_output_size(
2222
) -> Result<(), OutputTooSmall> {
2323
let coins_per_utxo_byte = protocol_parameters.coins_per_utxo_byte;
2424
let outputs_too_small = transaction
25-
.clone()
2625
.outputs
27-
.into_iter()
26+
.iter()
2827
.filter(|output| {
2928
let mut bytes = Vec::new();
3029
cbor::encode(output, &mut bytes)

0 commit comments

Comments
 (0)