0

When using the Python script:

timestamp = ScaleDecoder.get_decoder_class('Timestamp', ScaleBytes(timestamp_bytes_array)).decode()

it seems that the decoder expects the size of the array to be exactly equal to the object to be decoded. This is equivalent to the behavior of the DecodeAll trait in rust, where the remaining bytes after decoding must be zero.

How can I, in Python, do whatever is equivalent to Decode trait in rust, where the number of remaining bytes, after decoding, can be > 0, so that I can decode a stream?

1
  • After weeks of posting the question, I'm starting to wonder whether there's no way to do this at all... really weird. I would really appreciate any help here. Aug 13 at 19:08

1 Answer 1

1

There is kwarg you can pass to the decode() function, so it won't check the remaining bytes: decode(check_remaining=False).

I don't have much context of your use-case, but I assume you have added a custom type definition Timestamp to the type registry? Because by default there is no type with that name.

1
  • Thank you very much! I almost thought this sub is abandoned. Sep 27 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.