Page MenuHomePhabricator

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

Authored by tobias_ruck on Jun 25 2022, 23:11.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-add-hash
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19479
Build 38691: Build Diff
Build 38690: arc lint + arc unit