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:
ioxde
2025-09-08 20:19:13 -07:00
parent d219433466
commit 8ec1457858
7 changed files with 50 additions and 0 deletions
+13
View File
@@ -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);