You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support holder funding key rotation during splicing
We introduce a scalar tweak that can be applied to the base funding key
to obtain the channel's funding key used in the 2-of-2 multisig. This is
used to derive additional keys from the same secret backing the base
funding_pubkey, as we have to rotate keys for each successful splice
attempt.
The tweak is computed similar to existing tweaks used in
[BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation):
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.
Copy file name to clipboardExpand all lines: lightning/src/chain/package.rs
+56-4Lines changed: 56 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -605,7 +605,20 @@ impl PackageSolvingData {
605
605
let channel_parameters = &onchain_handler.channel_transaction_parameters;
606
606
matchself{
607
607
PackageSolvingData::RevokedOutput(ref outp) => {
608
-
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx,&outp.per_commitment_point,&outp.counterparty_delayed_payment_base_key,&outp.counterparty_htlc_base_key,&onchain_handler.signer.pubkeys().revocation_basepoint,&onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_revokeable_redeemscript(&chan_keys.revocation_key, outp.on_counterparty_tx_csv,&chan_keys.broadcaster_delayed_payment_key);
610
623
//TODO: should we panic on signer failure ?
611
624
ifletOk(sig) = onchain_handler.signer.sign_justice_revoked_output(channel_parameters,&bumped_tx, i, outp.amount.to_sat(),&outp.per_commitment_key,&onchain_handler.secp_ctx){
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx,&outp.per_commitment_point,&outp.counterparty_delayed_payment_base_key,&outp.counterparty_htlc_base_key,&onchain_handler.signer.pubkeys().revocation_basepoint,&onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc,&onchain_handler.channel_type_features(),&chan_keys.broadcaster_htlc_key,&chan_keys.countersignatory_htlc_key,&chan_keys.revocation_key);
622
648
//TODO: should we panic on signer failure ?
623
649
ifletOk(sig) = onchain_handler.signer.sign_justice_revoked_htlc(channel_parameters,&bumped_tx, i, outp.amount,&outp.per_commitment_key,&outp.htlc,&onchain_handler.secp_ctx){
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx,&outp.per_commitment_point,&outp.counterparty_delayed_payment_base_key,&outp.counterparty_htlc_base_key,&onchain_handler.signer.pubkeys().revocation_basepoint,&onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc,&onchain_handler.channel_type_features(),&chan_keys.broadcaster_htlc_key,&chan_keys.countersignatory_htlc_key,&chan_keys.revocation_key);
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx,&outp.per_commitment_point,&outp.counterparty_delayed_payment_base_key,&outp.counterparty_htlc_base_key,&onchain_handler.signer.pubkeys().revocation_basepoint,&onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc,&onchain_handler.channel_type_features(),&chan_keys.broadcaster_htlc_key,&chan_keys.countersignatory_htlc_key,&chan_keys.revocation_key);
let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
1954
1971
let signer = keys_provider.derive_channel_signer(keys_provider.generate_channel_keys_id(false,0));
1955
1972
let counterparty_signer = keys_provider.derive_channel_signer(keys_provider.generate_channel_keys_id(true,1));
1956
-
let delayed_payment_base = &signer.pubkeys().delayed_payment_basepoint;
1957
1973
let per_commitment_secret = SecretKey::from_slice(&<Vec<u8>>::from_hex("1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100").unwrap()[..]).unwrap();
1958
1974
let per_commitment_point = PublicKey::from_secret_key(&secp_ctx,&per_commitment_secret);
1959
-
let htlc_basepoint = &signer.pubkeys().htlc_basepoint;
1960
-
let holder_pubkeys = signer.pubkeys();
1961
-
let counterparty_pubkeys = counterparty_signer.pubkeys().clone();
1962
-
let keys = TxCreationKeys::derive_new(&secp_ctx,&per_commitment_point, delayed_payment_base, htlc_basepoint,&counterparty_pubkeys.revocation_basepoint,&counterparty_pubkeys.htlc_basepoint);
1975
+
let holder_pubkeys = signer.pubkeys(None,&secp_ctx);
1976
+
let counterparty_pubkeys = counterparty_signer.pubkeys(None,&secp_ctx).clone();
1963
1977
let channel_parameters = ChannelTransactionParameters{
0 commit comments