Function compute_funding_key_tweak

Source
pub fn compute_funding_key_tweak(
    base_funding_secret_key: &SecretKey,
    splice_parent_funding_txid: &Txid,
) -> Scalar
Expand description

Computes the tweak to apply to the base funding key of a channel.

The tweak is computed similar to existing tweaks used in BOLT-3:

  1. We use the txid of the funding transaction the splice transaction is spending instead of the per_commitment_point to guarantee uniqueness.
  2. We include the private key instead of the public key to guarantee only those with knowledge of it can re-derive the new funding key.

tweak = SHA256(splice_parent_funding_txid || base_funding_secret_key) tweaked_funding_key = base_funding_key + tweak

While the use of this tweak is not required (signers may choose to compute a tweak of their choice), signers must ensure their tweak guarantees the two properties mentioned above: uniqueness and derivable only by one or both of the channel participants.