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

Optional [ list [ Optional [ Data Structures ] ] ] #19157

Open
buggybuck opened this issue Jan 16, 2025 · 0 comments
Open

Optional [ list [ Optional [ Data Structures ] ] ] #19157

buggybuck opened this issue Jan 16, 2025 · 0 comments

Comments

@buggybuck
Copy link

Hi there!

I'm trying to deserialize this twisted little line here [1]:

message_data: Optional[list[Optional[SignatureRequestSourceData]]]

Does it mean that if there is a list (1st Optional) then the list will always contain at least one element? Either 0x00 if the SignatureRequestSourceData item isn't present or 0x01 plus the SignatureRequestSourceData item?

Is the inner Optional really necessary? I have the impression that the (non-)existence of the item is already established by the serialized length of the list, and deserializing the inner Optional feels a little futile. Although I enjoyed the little mind twist :) ;)

Kind regards

[1] https://github.com/Chia-Network/chia-blockchain/blob/main/chia/protocols/harvester_protocol.py#L95

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

No branches or pull requests

1 participant