mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-20 12:28:08 +00:00
perf: remove unnecessary clones in EventParser
This commit is contained in:
@@ -18,7 +18,7 @@ use crate::streaming::{
|
|||||||
get_global_program_ids, GenericEventParseConfig,
|
get_global_program_ids, GenericEventParseConfig,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Protocol, DexEvent,
|
DexEvent, Protocol,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use prost_types::Timestamp;
|
use prost_types::Timestamp;
|
||||||
@@ -84,7 +84,7 @@ impl EventParser {
|
|||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
inner_instructions,
|
inner_instructions,
|
||||||
Arc::clone(&callback),
|
callback.clone(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
// Immediately process inner instructions for correct ordering
|
// Immediately process inner instructions for correct ordering
|
||||||
@@ -114,7 +114,7 @@ impl EventParser {
|
|||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
Some(&inner_instructions),
|
Some(&inner_instructions),
|
||||||
Arc::clone(&callback),
|
callback.clone(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ impl EventParser {
|
|||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
inner_instructions,
|
inner_instructions,
|
||||||
Arc::clone(&callback),
|
callback.clone(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
// Immediately process inner instructions for correct ordering
|
// Immediately process inner instructions for correct ordering
|
||||||
@@ -197,7 +197,7 @@ impl EventParser {
|
|||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
Some(&inner_instructions),
|
Some(&inner_instructions),
|
||||||
Arc::clone(&callback),
|
callback.clone(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ impl EventParser {
|
|||||||
&inner_instructions,
|
&inner_instructions,
|
||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
callback.clone(),
|
callback,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
@@ -375,7 +375,7 @@ impl EventParser {
|
|||||||
// base64解码
|
// base64解码
|
||||||
let compiled_instruction = CompiledInstruction {
|
let compiled_instruction = CompiledInstruction {
|
||||||
program_id_index: ui_compiled.program_id_index,
|
program_id_index: ui_compiled.program_id_index,
|
||||||
accounts: ui_compiled.accounts.clone(),
|
accounts: ui_compiled.accounts.to_vec(),
|
||||||
data,
|
data,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ impl EventParser {
|
|||||||
inner_instructions,
|
inner_instructions,
|
||||||
bot_wallet,
|
bot_wallet,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
callback.clone(),
|
callback,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -699,7 +699,7 @@ impl EventParser {
|
|||||||
inner_index,
|
inner_index,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
)
|
)
|
||||||
.map(|event| ((*disc).clone(), (*config).clone(), event))
|
.map(|event| (*disc, *config, event))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@ impl EventParser {
|
|||||||
&config,
|
&config,
|
||||||
);
|
);
|
||||||
if !result.is_empty() {
|
if !result.is_empty() {
|
||||||
return Some(result[0].clone());
|
return result.into_iter().next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
@@ -735,7 +735,7 @@ impl EventParser {
|
|||||||
&event,
|
&event,
|
||||||
inner_instructions_ref,
|
inner_instructions_ref,
|
||||||
inner_index.unwrap_or(-1_i64) as i8,
|
inner_index.unwrap_or(-1_i64) as i8,
|
||||||
&accounts,
|
accounts,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -839,7 +839,7 @@ impl EventParser {
|
|||||||
inner_index,
|
inner_index,
|
||||||
transaction_index,
|
transaction_index,
|
||||||
)
|
)
|
||||||
.map(|event| ((*disc).clone(), (*config).clone(), event))
|
.map(|event| (*disc, *config, event))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -852,7 +852,7 @@ impl EventParser {
|
|||||||
let inner_event_handle = s.spawn(|| {
|
let inner_event_handle = s.spawn(|| {
|
||||||
for inner_instruction in inner_instructions_ref.instructions.iter() {
|
for inner_instruction in inner_instructions_ref.instructions.iter() {
|
||||||
let result = Self::parse_events_from_grpc_inner_instruction(
|
let result = Self::parse_events_from_grpc_inner_instruction(
|
||||||
&inner_instruction,
|
inner_instruction,
|
||||||
signature,
|
signature,
|
||||||
slot,
|
slot,
|
||||||
block_time,
|
block_time,
|
||||||
@@ -863,7 +863,7 @@ impl EventParser {
|
|||||||
&config,
|
&config,
|
||||||
);
|
);
|
||||||
if !result.is_empty() {
|
if !result.is_empty() {
|
||||||
return Some(result[0].clone());
|
return result.into_iter().next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
@@ -875,7 +875,7 @@ impl EventParser {
|
|||||||
&event,
|
&event,
|
||||||
inner_instructions_ref,
|
inner_instructions_ref,
|
||||||
inner_index.unwrap_or(-1_i64) as i8,
|
inner_index.unwrap_or(-1_i64) as i8,
|
||||||
&accounts,
|
accounts,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -931,7 +931,7 @@ impl EventParser {
|
|||||||
DexEvent::PumpFunTradeEvent(mut trade_info) => {
|
DexEvent::PumpFunTradeEvent(mut trade_info) => {
|
||||||
trade_info.is_dev_create_token_trade =
|
trade_info.is_dev_create_token_trade =
|
||||||
is_dev_address_in_signature(&signature, &trade_info.user)
|
is_dev_address_in_signature(&signature, &trade_info.user)
|
||||||
|| is_dev_address_in_signature(&signature, &trade_info.creator);
|
|| is_dev_address_in_signature(&signature, &trade_info.creator);
|
||||||
trade_info.is_bot = Some(trade_info.user) == bot_wallet;
|
trade_info.is_bot = Some(trade_info.user) == bot_wallet;
|
||||||
|
|
||||||
if let Some(swap_data) = trade_info.metadata.swap_data.as_mut() {
|
if let Some(swap_data) = trade_info.metadata.swap_data.as_mut() {
|
||||||
|
|||||||
Reference in New Issue
Block a user