rust-bitcoin-unsafe-fast/src/network
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
..
address.rs Refactor address byte swapping 2022-05-19 16:03:03 +10:00
constants.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
message.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
message_blockdata.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
message_bloom.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
message_filter.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
message_network.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
mod.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
stream_reader.rs Fix in preparation for next edition 2022-05-11 10:16:17 +10:00