jito_bundle/bundler/
types.rs1use crate::constants::MAX_BUNDLE_TRANSACTIONS;
2use solana_instruction::Instruction;
3
4pub type BundleInstructionSlots = [Option<Vec<Instruction>>; MAX_BUNDLE_TRANSACTIONS];
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum TipMode {
10 SeparateTx,
12 InlineLastTx,
14}
15
16pub trait BundleSlotView {
18 fn instruction_slots(&self) -> &BundleInstructionSlots;
20
21 fn populated_count(&self) -> usize {
23 self.instruction_slots()
24 .iter()
25 .filter(|slot| slot.is_some())
26 .count()
27 }
28
29 fn last_populated_index(&self) -> Option<usize> {
31 self.instruction_slots()
32 .iter()
33 .rposition(|slot| slot.is_some())
34 }
35}
36
37pub fn empty_instruction_slots() -> BundleInstructionSlots {
39 std::array::from_fn(|_| None)
40}