HomePhabricator

[Chronik] Add hash structs for type-safe and endian-safe handling of hashes

Description

[Chronik] Add hash structs for type-safe and endian-safe handling of hashes

Summary:
Allows type-safe handling of hashes, so e.g. Sha256 and Sha256d
can't be mixed.

It is designed to force making endianness explicit as much as possible, as
the different protocols used with Bitcoin ABC use varying endianness:

  • In the Bitcoin protocol:
    • Byte order is little-endian
    • Hex representation is big-endian
  • In the SLP protocol:
    • Byte order is big-endian
    • Hex representation is big-endian

Test Plan: cmake .. -GNinja -DBUILD_BITCOIN_CHRONIK=on && ninja check-bitcoinsuite

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D11670

Details

Provenance
tobias_ruckAuthored on Jun 25 2022, 23:08
tobias_ruckPushed on Jul 5 2022, 14:51
Reviewer
Restricted Project
Differential Revision
D11670: [Chronik] Add hash structs for type-safe and endian-safe handling of hashes
Parents
rABC023ec18fb65e: [Chronik] Add clippy linter as build target
Branches
Unknown
Tags
Unknown