Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 calculates 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 hex strings 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.
- Loading branch information
Showing
1 changed file
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters