File tree 3 files changed +4
-9
lines changed
3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ pub fn validate_block(
94
94
None => Vec :: new ( ) ,
95
95
} ;
96
96
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)
97
99
for ( i, ( transaction, raw_transaction) ) in
98
100
( 0u32 ..) . zip ( transactions. iter ( ) . zip ( raw_transactions) )
99
101
{
Original file line number Diff line number Diff line change @@ -12,12 +12,6 @@ impl Into<TransactionRuleViolation> for NonDisjointRefInputs {
12
12
}
13
13
}
14
14
15
- // impl From<NonDisjointRefInputs> for TransactionRuleViolation {
16
- // fn from(value: NonDisjointRefInputs) -> Self {
17
- // TransactionRuleViolation::NonDisjointRefInputs(value)
18
- // }
19
- // }
20
-
21
15
pub fn disjoint_ref_inputs ( transaction : & TransactionBody ) -> Result < ( ) , NonDisjointRefInputs > {
22
16
let intersection = match & transaction. reference_inputs {
23
17
Some ( ref_inputs) => ref_inputs
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use amaru_kernel::{
6
6
use crate :: rules:: TransactionRuleViolation ;
7
7
8
8
pub struct OutputTooSmall {
9
- pub outputs_too_small : Vec < TransactionOutput > ,
9
+ pub outputs_too_small : Vec < & TransactionOutput > ,
10
10
}
11
11
12
12
impl Into < TransactionRuleViolation > for OutputTooSmall {
@@ -22,9 +22,8 @@ pub fn validate_output_size(
22
22
) -> Result < ( ) , OutputTooSmall > {
23
23
let coins_per_utxo_byte = protocol_parameters. coins_per_utxo_byte ;
24
24
let outputs_too_small = transaction
25
- . clone ( )
26
25
. outputs
27
- . into_iter ( )
26
+ . iter ( )
28
27
. filter ( |output| {
29
28
let mut bytes = Vec :: new ( ) ;
30
29
cbor:: encode ( output, & mut bytes)
You can’t perform that action at this time.
0 commit comments