Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Split a base OTX iterator for more use cases #45

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xxuejie
Copy link

@xxuejie xxuejie commented Apr 22, 2024

No description provided.

@XuJiandong
Copy link
Collaborator

There is ongoing PR: #44.
It follows OTX spec and with lazy reader.

@xxuejie
Copy link
Author

xxuejie commented Apr 22, 2024

It remains a question if/when the other big PR is gonna merge.

If it gets merged early, I can adjust the code accordingly.
If the other PR is gonna take a while, this PR still has its merits at the moment.

let input_iter = raw_tx
.inputs()
.into_iter()
.skip(otx_structure.input_cell_start)
Copy link
Collaborator

@XuJiandong XuJiandong Apr 23, 2024

Choose a reason for hiding this comment

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

The skip(n) method doesn't report any error when the count of the iterator is smaller than n. The same applies to the take method.

Copy link
Author

Choose a reason for hiding this comment

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

2 points:

  • Note that current code already follows this behavior, I'm just moving code around here, I don't really change anything
  • If you think about it: is it really a problem: when one has less input cells than the OTX needs, a different seal will be calculated, making the signature validation failed. So to me, I don't think an error is required here.

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