block-headers-client icon indicating copy to clipboard operation
block-headers-client copied to clipboard

transactionCount is 0

Open Klar opened this issue 2 years ago • 4 comments

transactionCount is always 0, block-headers-client seems to be synced i.e latest block.

curl localhost:8080/api/v1/chain/header/byHeight?height=111 | jq [ { "hash": "000000004d6a6dd8b882deec7b54421949dddd2c166bd51ee7f62a52091a6c35", "version": 1, "prevBlockHash": "00000000a30e366158a1813a6fda9f913497000a68f1c008b9f935b866cee55b", "merkleRoot": "e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97", "creationTimestamp": 1231669673, "difficultyTarget": 486604799, "nonce": 4076340484, "transactionCount": 0, "work": 4295032833 } ]

curl localhost:8080/api/v1/chain/header/byHeight?height=53632 | jq [ { "hash": "0000000007e3599bd68f98d157d3f20c2f7bfd20425e75e4f240601136721243", "version": 1, "prevBlockHash": "000000000a092c00132d96afc15c71f4d9b7102a22aff200e379652823bfd0c7", "merkleRoot": "c5e25d3bdf874b3fb22a23e4f6a41b064dbc35cde523d7502e073e6258dd2f8e", "creationTimestamp": 1272529571, "difficultyTarget": 471225455, "nonce": 205556418, "transactionCount": 0, "work": 49239612792 } ]

curl localhost:8080/api/v1/chain/tips | jq [ { "header": { "hash": "000000000000000005a6f74c10a5475c91c83aa04315c0724c91a18337af3f42", "version": 1073733632, "prevBlockHash": "000000000000000009a58b63f26498fa69077d31385dc7b815d8ee9aeb5a6ec6", "merkleRoot": "cf3272201f9d3af64593ad1b5b5d153e7f1fbb4633b490d60cfe74b96455f1d9", "creationTimestamp": 1660569967, "difficultyTarget": 403624649, "nonce": 821452442, "transactionCount": 0, "work": 318575563526575900000 }, "state": "LONGEST_CHAIN", "chainWork": 380740663188207560000000000, "height": 752808, "confirmations": 1 } ]

Klar avatar Aug 15 '22 13:08 Klar

bump

Klar avatar May 31 '23 09:05 Klar

Confirmed in version 2.0.4, confirmed in version 1.0.0.

Danconnolly avatar Jun 05 '23 07:06 Danconnolly

It is not possible to determine the number of transactions in a block using SPV. To determine the number of transactions in a block using the existing P2P protocol, one would have to download the whole block. This would be inconsistent with the principles of SPV.

This field should not have been added to the result set. It will be removed. However, to do so would be a change in the API, so this change will only occur during the release of the next major version. This bug is in itself not enough to trigger the release of a new major version.

So, this bug will remain for now.

I've added a backlog item to implement this bugfix https://github.com/bitcoin-sv/block-headers-client/issues/24

Danconnolly avatar Jun 05 '23 07:06 Danconnolly

This ticket should remain open until the bug is fixed for visibility.

Danconnolly avatar Jun 05 '23 07:06 Danconnolly