8000 Add Block::get_size() and Block::get_weight() by shesek · Pull Request #417 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Block::get_size() and Block::get_weight() #417

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

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

shesek
Copy link
Contributor
@shesek shesek commented Mar 23, 2020

They're a bit tricky to get right (I was missing the size of the tx count varint when I initially implemented this in another project), so could be useful to have this as part of rust-bitcoin.

Depends on #416.

@codecov-io
Copy link

Codecov Report

Merging #417 into master will increase coverage by 0.25%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #417      +/-   ##
==========================================
+ Coverage   85.81%   86.07%   +0.25%     
==========================================
  Files          40       40              
  Lines        7461     7698     +237     
==========================================
+ Hits         6403     6626     +223     
- Misses       1058     1072      +14     
Impacted Files Coverage Δ
src/blockdata/block.rs 83.71% <100.00%> (+3.85%) ⬆️
src/blockdata/transaction.rs 95.23% <100.00%> (+1.31%) ⬆️
src/util/psbt/raw.rs 79.16% <0.00%> (-1.69%) ⬇️
src/util/address.rs 85.41% <0.00%> (-0.90%) ⬇️
src/consensus/encode.rs 89.24% <0.00%> (-0.76%) ⬇️
src/network/message.rs 95.17% <0.00%> (+0.03%) ⬆️
src/util/amount.rs 89.02% <0.00%> (+0.03%) ⬆️
src/blockdata/script.rs 78.59% <0.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cff794...83982da. Read the comment docs.

shesek added a commit to Blockstream/electrs that referenced this pull request Mar 24, 2020
- Fixes a bug in block weight calculation, which didn't take the size of the block
  header and tx count varint into account.

- Avoids re-serializing blocks in order to determine their size during the indexing process.

- Avoids re-serializing transactions in order to include their size in API responses.

This depends on two unmerged PRs that are implemented in blockstream/rust-bitcoin#0.23-electrs:

rust-bitcoin/rust-bitcoin#416
rust-bitcoin/rust-bitcoin#417
@apoelstra
Copy link
Member

Can you rebase? Seems that there are still two commits in this PR even after #416 is merged

@shesek shesek force-pushed the 202003-block-size-weight branch from 83982da to 94032f6 Compare March 27, 2020 18:55
@shesek
Copy link
Contributor Author
shesek commented Mar 27, 2020

@apoelstra rebased

@apoelstra apoelstra merged commit c3a7d1b into rust-bitcoin:master Apr 7, 2020
SatoKentaNayoro pushed a commit to boolnetwork/mempool-electrs that referenced this pull request Nov 29, 2024
- Fixes a bug in block weight calculation, which didn't take the size of the block
  header and tx count varint into account.

- Avoids re-serializing blocks in order to determine their size during the indexing process.

- Avoids re-serializing transactions in order to include their size in API responses.

This depends on two unmerged PRs that are implemented in blockstream/rust-bitcoin#0.23-electrs:

rust-bitcoin/rust-bitcoin#416
rust-bitcoin/rust-bitcoin#417
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.

4 participants
0