Why Nostr? What is Njump?
2023-06-07 15:29:13
in reply to

Wladimir [ARCHIVE] on Nostr: 📅 Original date posted:2015-02-01 📝 Original message:On Sun, 1 Feb 2015, Tamas ...

📅 Original date posted:2015-02-01
📝 Original message:On Sun, 1 Feb 2015, Tamas Blummer wrote:

> I wonder of consequences if var_int is used in its longer than necessary forms (e.g encoding 1 as 0xfd0100 instead of 0x01)

In serialize.h lingo you are talking about CompactSize, not VarInt.

CompactSizes indeed have redundancy in their representation, i.e. the same
number can be represented as up to four different byte sequences.

VARINTs have a different format that (AFAIK) isn't used anywhere in
the block chain. See WriteVarInt / ReadVarInt. These were designed to
not have any redundancy in their representation.

> This is already of interest if applying size limit to a block, since transaction count is var_int but is not part of the hashed header or the
> merkle tree.

Are you sure that this is a current concern? Non-canonical CompactSizes
are forbidden - in serialize.h this is flagged in ReadCompactSize.

Wladimir
Author Public Key
npub1xqshkqv2g7uea4xzqwvmgjcz7u8vfavw6aazs999v0azsv3w7u3qpymc2p