Ava Chow 33adc7521c
Merge bitcoin/bitcoin#30765: refactor: Allow CScript's operator<< to accept spans, not just vectors
5e190cd11f6ed8b7ab4db0f01192de63deaf6fd7 Replace CScript _hex_v_u8 appends with _hex (Lőrinc)
cac846c2fbf6fc69bfc288fd387aa3f68d84d584 Allow CScript's operator<< to accept spans, not just vectors (Lőrinc)
c78d8ff4cb83506413bb73833fc5c04885d0ece8 prevector: avoid GCC bogus warnings in insert method (Lőrinc)

Pull request description:

  Split out of https://github.com/bitcoin/bitcoin/pull/30377#discussion_r1722326803.

  Replace `_hex_v_u8` for `CScript` appends to `_hex`, to skip vector conversion before serializing to the `prevector` in `CScript`.

  To enable both `unsigned char` and `std::byte` values, I've extracted the existing serialization to append the size & data in separate private methods to clarify that it does more than just a simple data insertion.

  There were also discussion on eliminating the operators here completely to obviate when we're serializing fixed-size collections as raw bytes, and when we're prefixing them with their size - should also be done in a separate PR.

ACKs for top commit:
  achow101:
    ACK 5e190cd11f6ed8b7ab4db0f01192de63deaf6fd7
  ryanofsky:
    Code review ACK 5e190cd11f6ed8b7ab4db0f01192de63deaf6fd7. Looks good!
  hodlinator:
    re-ACK 5e190cd11f6ed8b7ab4db0f01192de63deaf6fd7

Tree-SHA512: 27a646629e017b2a05416d5eb964dda8b25b900d466221eff7bfa1339ded443e1c5c4cf8ff20cb3bba915a2603787a9fa6f6ec12bc0b9415d9eb07b57289192b
2024-09-20 15:16:53 -04:00
..
2024-08-16 19:27:40 +01:00
2023-11-21 13:15:44 +00:00
2024-07-08 11:12:01 +02:00
2023-11-30 11:27:54 +01:00