rust-bitcoin-unsafe-fast/bitcoin
Steven Roose 18d8b0e469
Replace VarInt type with ReadExt and WriteExt functions
At some stage we named the compact encoding `VarInt` (which makes sense
because the compact size encoding is a variable length integer encoding).
However it turns out the term "varint" is used in Core for a different
encoding so this may lead to confusion.

While we fix this naming thing observe also that the `VarInt` type is
unnecessarily complicated, all we need to be able to do is encode and
decode integers in compact form as specified by Core. We can do this
simply by extending our `WriteExt` and `ReadExt` traits.

Add `emit_compact_size` and `read_compact_size` to emit and read compact
endcodings respectively.

Includes addition of `internals::compact_size::encoded_size_const`.

Patch originally written by Steven, Tobin cherry-picked and did a bunch
of impovements after the varint vs compact_size thing (#1016).

ref: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer

Co-developed-by: Tobin C. Harding <me@tobin.cc>
2024-09-25 06:56:09 +10:00
..
contrib Add Arbitrary dependency 2024-08-23 15:39:20 -05:00
embedded Move opcodes to primitives 2024-07-09 15:26:33 +10:00
examples Stop using all_zeros 2024-09-11 10:39:49 +10:00
src Replace VarInt type with ReadExt and WriteExt functions 2024-09-25 06:56:09 +10:00
tests Refactor GetKey to take the KeyRequest by reference 2024-09-13 14:49:54 +03:00
CHANGELOG.md Capitalize Merkle 2024-07-01 17:42:43 +01:00
Cargo.toml Merge rust-bitcoin/rust-bitcoin#3375: Release tracking PR: `bitcoin-internals 0.4.0` 2024-09-23 18:32:23 +00:00