rust-bitcoin-unsafe-fast/src
Tobin C. Harding 07c75304d2 Refactor address byte swapping
When encoding a `network::Address` two of the fields are encoded
big-endian instead of little-endian as is done by `consensus_encode`. In
order to achieve this we have a helper function `addr_to_be` that swaps
the bytes. This function is miss-named because it is not converting to a
specific endian-ness (which implies different behaviour on machines with
different endian-ness) but is reversing the byte order irrespective of
the underlying architecture.

- Remove function `addr_to_be`
- Inline the endian-ness code when encoding an address
- Remove TODO and use `to_be_bytes` when encoding port
- Add a function for reading big-endian bytes `read_be_address`
- Use `read_be_address` when decoding `Address` and `Addrv2`

Refactor only, no logic changes. Code path is already covered by
unit tests.
2022-05-19 16:03:03 +10:00
..
blockdata Enable edition 2018 2022-05-11 10:16:48 +10:00
consensus Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
network Refactor address byte swapping 2022-05-19 16:03:03 +10:00
util Enable edition 2018 2022-05-11 10:16:48 +10:00
hash_types.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
internal_macros.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
lib.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
policy.rs Flatten the policy module 2022-03-09 10:20:18 +11:00
serde_utils.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
test_macros.rs Refactor whitespace 2022-03-14 13:51:50 +11:00