0

I've been studying the Bitcoin Core code, and I noticed that it uses a template READWRITE to serialize data structures for storing blocks. But it never seems to actually call "READWRITE(nTxs)", the VARINT (CompactSize) that encodes the number of transactions. It reads the transactions to a vector (primitives/block.h), and it almost seems like it just magically knows how many txs there are. What gives?

2 Answers 2

1

The transactions are passed in as a vector. Bitcoin Core's serialization framework understands that all vectors should be serialized with a compact sized unsigned integer preceding the serialization of the data within the vector itself.

1
  • Just want to add that "a compact sized unsigned integer preceding each object in the vector" might be confusing, as there is only one CompactSize int preceding the entire set. Commented Nov 29, 2017 at 7:20
0

Unsigned integer? This is NOT a good thing, because a PROPRIETARY routine created by the cryptocurrency ISSUER can instantly ALTER the block's AUTHENTICITY, and ergo, it's REAL VALUE. (i.e. ZERO...like any form of COUNTERFEIT or "Ponzi unit". Or are We mistaken?)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.