Skip to content

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

Open
xxuejie wants to merge 2 commits intocryptape:mainfrom
xxuejie:split-otx-iterator
Open

refactor: Split a base OTX iterator for more use cases#45
xxuejie wants to merge 2 commits intocryptape:mainfrom
xxuejie:split-otx-iterator

Conversation

@xxuejie
Copy link

@xxuejie xxuejie commented Apr 22, 2024

No description provided.

@xxuejie xxuejie requested review from XuJiandong and quake April 22, 2024 02:39
@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