Skip to content

fix: handle output-only type scripts in native-simulator#24

Merged
mohanson merged 1 commit into
nervosnetwork:mainfrom
quake:quake/fix-output-only-type-scripts
Jan 28, 2026
Merged

fix: handle output-only type scripts in native-simulator#24
mohanson merged 1 commit into
nervosnetwork:mainfrom
quake:quake/fix-output-only-type-scripts

Conversation

@quake

@quake quake commented Jan 27, 2026

Copy link
Copy Markdown
Member

When a type script only appears on outputs (e.g., genesis transactions), input_indices is empty. This caused an index-out-of-bounds panic when trying to access input_indices[0].

This fix checks if input_indices is empty and falls back to using output_indices[0] with is_output set to true, which correctly handles genesis/creation scenarios for type scripts.

@quake quake requested review from XuJiandong and mohanson January 27, 2026 10:31
When a type script only appears on outputs (e.g., genesis transactions),
input_indices is empty. This caused an index-out-of-bounds panic when
trying to access input_indices[0].

This fix checks if input_indices is empty and falls back to using
output_indices[0] with is_output set to true, which correctly handles
genesis/creation scenarios for type scripts.
@quake quake force-pushed the quake/fix-output-only-type-scripts branch from af5a67a to c087122 Compare January 27, 2026 10:36

@mohanson mohanson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mohanson mohanson merged commit 3ab863b into nervosnetwork:main Jan 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants