diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index 4b93a38b..9cfffb1e 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -433,15 +433,22 @@ fn handle_log( if !kimap::valid_note(¬e) { return Err(anyhow::anyhow!("skipping invalid note: {note}")); } - if let Some(block_number) = log.block_number { - print_to_terminal( - 1, - &format!("adding note to pending_notes for block {block_number}"), - ); - pending_notes - .entry(block_number) - .or_default() - .push((decoded, 0)); + // handle note: if it precedes parent mint event, add it to pending_notes + if let Err(e) = handle_note(state, &decoded) { + if let Some(KnsError::NoParentError) = e.downcast_ref::() { + if let Some(KnsError::NoParentError) = e.downcast_ref::() { + if let Some(block_number) = log.block_number { + print_to_terminal( + 1, + &format!("adding note to pending_notes for block {block_number}"), + ); + pending_notes + .entry(block_number) + .or_default() + .push((decoded, 0)); + } + } + } } } _log => {