Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge rust-bitcoin#968: Refactor address byte swapping
07c7530 Refactor address byte swapping (Tobin C. Harding) Pull request description: 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. ACKs for top commit: apoelstra: ACK 07c7530 Kixunil: ACK 07c7530 Tree-SHA512: 186bc86512e264a7b306f3bc2e18d1619f3cd84fc54412148cfc2663e8d6e9616ea9e2fe19eafec72d76cc11367a9b39cac2b73210d9e43eb8f453bd253b33de
- Loading branch information