mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-16 18:38:05 +00:00
feat(event_parser): add requires_inner_instruction field to skip incomplete events
- Add requires_inner_instruction field to GenericEventParseConfig - Skip events that require but lack inner instruction data during processing - Set PumpFun migrate events to require inner instructions (prevents parsing failed migrations)
This commit is contained in:
@@ -891,6 +891,7 @@ pub struct GenericEventParseConfig {
|
||||
pub event_type: EventType,
|
||||
pub inner_instruction_parser: Option<InnerInstructionEventParser>,
|
||||
pub instruction_parser: Option<InstructionEventParser>,
|
||||
pub requires_inner_instruction: bool,
|
||||
}
|
||||
|
||||
/// 内联指令事件解析器
|
||||
@@ -1200,6 +1201,12 @@ impl EventParser for GenericEventParser {
|
||||
event.set_swap_data(swap_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip events that require inner instruction data but don't have it
|
||||
if config.requires_inner_instruction && inner_instruction_event.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 合并事件
|
||||
if let Some(inner_instruction_event) = inner_instruction_event {
|
||||
event.merge(&*inner_instruction_event);
|
||||
@@ -1335,6 +1342,12 @@ impl EventParser for GenericEventParser {
|
||||
event.set_swap_data(swap_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip events that require inner instruction data but don't have it
|
||||
if config.requires_inner_instruction && inner_instruction_event.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 合并事件
|
||||
if let Some(inner_instruction_event) = inner_instruction_event {
|
||||
event.merge(&*inner_instruction_event);
|
||||
|
||||
Reference in New Issue
Block a user