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

Make payment_key derivation deterministic #3391

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Commits on Nov 6, 2024

  1. Drop InMemorySigner Writeable impl

    ... which we haven't been using since 0.0.119 / commit
    7a951b1.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    6dfe913 View commit details
    Browse the repository at this point in the history
  2. Rename payment_key to payment_basepoint in chan_utils

    .. as it doesn't use the actual signer's `payment_key`, but the
    associated public key.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    75c2b0a View commit details
    Browse the repository at this point in the history
  3. Rename params to channel_keys_id and take it by value

    .. to make the name more clear and since before we `clone` it in
    `derive_channel_keys` anyways.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    611c1a3 View commit details
    Browse the repository at this point in the history
  4. Rename keys_id to channel_keys_id

    .. to align the field everywhere.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    6be731e View commit details
    Browse the repository at this point in the history
  5. Rename payment_point to payment_basepoint

    .. to align the field naming with the spec for clarity.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    ed2d63e View commit details
    Browse the repository at this point in the history
  6. Make payment_key derivation deterministic

    Previously, `KeysManager::derive_channel_keys` would derive the
    channel's `payment_key` uniquely on a per-channel basis which would
    disallow users losing their `channel_keys_id` to recover funds. As it's
    no real necessity to have `payment_key` derivation depend on
    `channel_keys_id` we can allow for easier recovery of any non-HTLC
    encumbered funds if we make `payment_key` derivation deterministic.
    
    To this end, we use the first byte of `channel_keys_id` as a versioning
    byte indicating the version of the used channel keys derivation scheme.
    Note that Previously `KeysManager::generate_channel_keys_id` would with
    very high likelyhood never have generated a `channel_keys_id` with a
    non-null first byte, which makes this a backwards-compatible change for
    any users that didn't run custom implementations of
    `SignerProvider::generate_channel_keys_id` conflicting with this
    assumption.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    aea8e5e View commit details
    Browse the repository at this point in the history
  7. f Adjust test cases to accommodate new derivation scheme

    Some test cases have hard-coded values which we change here (to be
    squashed in after review).
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    a781d23 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    bf14ec8 View commit details
    Browse the repository at this point in the history
  9. Have SignerProvider::get_shutdown_scriptpubkey take channel_keys_id

    .. to allow users to return specific scripts per channel.
    tnull committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    c70f7ec View commit details
    Browse the repository at this point in the history