Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge rust-bitcoin/rust-bitcoin#878: Add chain hash type using consts
8e29f2b Add ChainHash type (Tobin Harding) cd8f511 blockdata: constants: Use wildcard import in unit tests (Tobin Harding) 71bf196 Use fully qualified path in macro (Tobin Harding) Pull request description: 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 coded 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. Closes: #481 ACKs for top commit: Kixunil: ACK 8e29f2b sanket1729: ACK 8e29f2b. Tree-SHA512: 8156bb55838b73694ddf77a606cbe403f53a31d363aa0dee11b97dc31aa9b62609d7d84b8f0f92c08e90372a3e8c7b416fb07989d6da9633763373b41339b1f5
- Loading branch information
Showing
2 changed files
with
76 additions
and
7 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
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