Skip to content

types: fix getblockstats txs field doc#592

Open
satsfy wants to merge 1 commit into
rust-bitcoin:masterfrom
satsfy:fix-getblockstats-txs-doc
Open

types: fix getblockstats txs field doc#592
satsfy wants to merge 1 commit into
rust-bitcoin:masterfrom
satsfy:fix-getblockstats-txs-doc

Conversation

@satsfy
Copy link
Copy Markdown
Contributor

@satsfy satsfy commented May 15, 2026

Docs are wrong in getblockstats txs field. The txs field counts all transactions in the block including the coinbase. Core's source passes block.vtx.size() directly, which includes the coinbase transaction at index 0. Bitcoin Core doc agrees.

Example, I just called

bitcoin-cli -regtest generatetoaddress 101 (bitcoin-cli -regtest getnewaddress)

Now I run

bitcoin-cli -regtest getblockstats 50 | grep "\"txs\""
  "txs": 1,

Returns 1 because that is the coinbase transaction.

The txs field counts all transactions in the block including the coinbase.
@satsfy satsfy force-pushed the fix-getblockstats-txs-doc branch from 111605e to 01fc4f2 Compare May 15, 2026 19:23
Copy link
Copy Markdown
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the docs and it looks like this changed in v20, i.e. v17-19 say (excluding coinbase). I didn't check if it actually changed or the docs were fixed. I say this because I know of other cases where the docs in v17 or so were incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants