Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chain hash type using consts #878

Merged

Commits on May 19, 2022

  1. Use fully qualified path in macro

    As we do for the rest of the macros use the fully qualified path to
    `fmt` so users of the macro do not have to import it.
    tcharding committed May 19, 2022
    Copy the full SHA
    71bf196 View commit details
    Browse the repository at this point in the history
  2. blockdata: constants: Use wildcard import in unit tests

    Import with wildcard is applicable in unit tests, use it.
    tcharding committed May 19, 2022
    Copy the full SHA
    cd8f511 View commit details
    Browse the repository at this point in the history
  3. 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.
    tcharding committed May 19, 2022
    Copy the full SHA
    8e29f2b View commit details
    Browse the repository at this point in the history