Skip to content

Commit b2ba2a2

Browse files
committed
Reduce size of policies vec if not used
1 parent c032a1a commit b2ba2a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/services/block_aggregator_api/src/blocks/importer_and_db_source/serializer_adapter.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,25 +609,33 @@ fn proto_policies_from_policies(
609609
policies: &fuel_core_types::fuel_tx::policies::Policies,
610610
) -> ProtoPolicies {
611611
let mut values = [0u64; 6];
612+
let mut truncated_len = 0;
612613
if let Some(value) = policies.get(PolicyType::Tip) {
613614
values[0] = value;
615+
truncated_len = 1;
614616
}
615617
if let Some(value) = policies.get(PolicyType::WitnessLimit) {
616618
values[1] = value;
619+
truncated_len = 2;
617620
}
618621
if let Some(value) = policies.get(PolicyType::Maturity) {
619622
values[2] = value;
623+
truncated_len = 3;
620624
}
621625
if let Some(value) = policies.get(PolicyType::MaxFee) {
622626
values[3] = value;
627+
truncated_len = 4;
623628
}
624629
if let Some(value) = policies.get(PolicyType::Expiration) {
625630
values[4] = value;
631+
truncated_len = 5;
626632
}
627633
if let Some(value) = policies.get(PolicyType::Owner) {
628634
values[5] = value;
635+
truncated_len = 6;
629636
}
630637
let bits = policies.bits();
638+
values[..truncated_len].to_vec();
631639
ProtoPolicies {
632640
bits,
633641
values: values.to_vec(),

0 commit comments

Comments
 (0)