ZcashFoundation / zebra

Zcash - Financial Privacy in Rust 🦓
https://zfnd.org/zebra/
Apache License 2.0
412 stars 106 forks source link

getblock: return the `size` field #9020

Open conradoplg opened 1 week ago

conradoplg commented 1 week ago

Motivation

To match zcashd we need to return the size field to the getblock RPC.

Specifications

No response

Complex Code or Requirements

Be aware that the naive approach might have very poor performance. Look into alternatives (can it be computed on the fly from existing data?), with the last resort adding a new column to the database.

An idea: the block header and txs are stored serialized in the database. The block size can be computed from those, without requiring a serialization roundtrip, which would already save time (deserialization is expensive). This would require adding new State service functions to get the raw block / txs. Also, look whether getting just the size of those from the database is even faster.

Testing

No response

Related Work

No response