rust-bitcoin-unsafe-fast/src
Tobin Harding 8e29f2b493 Add ChainHash type
The Lightning network defines a type called 'chain hash' that is used to
uniquely represent the various Bitcoin networks as a 32 byte hash value.
Chain hash is now being used by the DLC folks, as such it is useful to
have it implemented in rust-bitcoin.

One method of calculating a chain hash is by hashing the genesis block
for the respective network.

Add a `ChainHash` type that can be used to get the unique identifier of
each of the 4 Bitcoin networks we support. Add a method that returns
the chain hash for a network using the double sha256 of the genesis
block. Do so using hard coded consts and add unit
tests (regression/sanity) that show these hard code byte arrays match
the hash of the data we return for the genesis block for the respective
network.

The chain hash for the main Bitcoin network can be verified from LN
docs (BOLT 0), add a link to this document.
2022-05-19 15:07:39 +10:00
..
blockdata Add ChainHash type 2022-05-19 15:07:39 +10:00
consensus Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
network Fix in preparation for next edition 2022-05-11 10:16:17 +10:00
util Enable edition 2018 2022-05-11 10:16:48 +10:00
hash_types.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
internal_macros.rs Use fully qualified path in macro 2022-05-19 14:14:32 +10:00
lib.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
policy.rs Flatten the policy module 2022-03-09 10:20:18 +11:00
serde_utils.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
test_macros.rs Refactor whitespace 2022-03-14 13:51:50 +11:00