Skip to content

Fail association of a block with sizes that are not storable. - #1110

Merged
evoskuil merged 1 commit into
libbitcoin:masterfrom
echennells:fix/txs-size
Nov 27, 2026
Merged

evoskuil merged 1 commit into
libbitcoin:masterfrom
echennells:fix/txs-size

Conversation

@echennells

@echennells echennells commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Block sizes are stored in 23 bits (schema::size less the flag), and are truncated when written. A compact block is associated by tx links before its block checks, so a block of 2^23 bytes or more is stored with its size modulo 2^23, and the deferred size and weight checks in check_pooled_block and accept_pooled_block read the truncated value. If any tx is not sufficiently pooled, get_wire_block cannot write the block to that size and validation faults (validate2).

The merge assertion tests only the flag bit, so it does not catch a size that leaves that bit clear.

This adds txs::is_storable (as header::is_storable), asserts it in merge, and returns txs_size from set_txs, which all three writers use. Full blocks cannot reach it within the default request limit.

Land with libbitcoin/libbitcoin-node#1293, as node otherwise faults on txs_size.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 92.732% (+0.002%) from 92.73% — echennells:fix/txs-size into libbitcoin:master

@evoskuil
evoskuil merged commit aba085b into libbitcoin:master Nov 27, 2026
23 checks passed
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.

3 participants