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

BlockExtra version 1 binary format #81

Open
2 tasks
RCasatta opened this issue Aug 28, 2023 · 0 comments
Open
2 tasks

BlockExtra version 1 binary format #81

RCasatta opened this issue Aug 28, 2023 · 0 comments

Comments

@RCasatta
Copy link
Owner

At the moment BlockExtra contains a bitcoin::Block

pub block: Block,

There are cases when you are interested only in a small fraction of the block and paying the cost of allocating all the block objects could impact performance. In other words, the cases where bitcoin_slices make sense.

What could help would be a BlockExtra version with Vec<u8> instead of a Block so that the downstream user could avoid instantiating a Block and use a bitcoin_slices::Visitor instead.

We have the byte size of the Block in BlockExtra, however in the binary format it appears after the block data, thus we cannot "skip" block parsing that is variable lenght.

Binary format version 1 could instead write the size before the Block so that if the user require the faster version could simply allocate a single Vec<u8> for the block .

steps:

  • release a 1.x version where version greater than 1 errors
  • make the PR, change the binary format and change crate version to 2.x, this version could decode both version 0 and 1, and encode the 2 versions according to a parameter, use version 0 by default so that version upgrade is opt-in
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