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
Let CommitmentTransaction build the TxCreationKeys it will cache
Instead of asking callers to generate the `TxCreationKeys` on every
new commitment before constructing a `CommitmentTransaction`, let
`CommitmentTransaction` derive the `TxCreationKeys` it will use to
build the raw commitment transaction that it will cache.
This allows a tighter coupling between the per-commitment keys, and the
corresponding commitment transaction.
As new states are generated, callers now only have to derive new
commitment points; `CommitmentTransaction` takes care of deriving the
per-commitment keys.
This also serves to limit the objects in LDK that derive per-commitment
keys according to the LN Specification in preparation for enabling
custom derivations in the future.
let inner = CommitmentTransaction::new_with_auxiliary_htlc_data(0,0,0,keys,0, htlcs,&channel_parameters.as_counterparty_broadcastable());
1157
+
let inner = CommitmentTransaction::new_with_auxiliary_htlc_data(0,&dummy_key.clone(),0,0,0, htlcs,&channel_parameters.as_counterparty_broadcastable(),&secp_ctx);
use bitcoin::secp256k1::{self,PublicKey,SecretKey,Secp256k1};
1927
1921
usecrate::util::test_utils;
1928
1922
usecrate::sign::{ChannelSigner,SignerProvider};
1929
1923
use bitcoin::{Network,Txid,ScriptBuf,CompressedPublicKey};
@@ -1938,11 +1932,12 @@ mod tests {
1938
1932
1939
1933
structTestCommitmentTxBuilder{
1940
1934
commitment_number:u64,
1941
-
keys:TxCreationKeys,
1935
+
per_commitment_point:PublicKey,
1942
1936
feerate_per_kw:u32,
1943
1937
htlcs_with_aux:Vec<(HTLCOutputInCommitment,())>,
1944
1938
channel_parameters:ChannelTransactionParameters,
1945
1939
counterparty_pubkeys:ChannelPublicKeys,
1940
+
secp_ctx:Secp256k1::<secp256k1::All>,
1946
1941
}
1947
1942
1948
1943
implTestCommitmentTxBuilder{
@@ -1953,13 +1948,10 @@ mod tests {
1953
1948
let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
1954
1949
let signer = keys_provider.derive_channel_signer(keys_provider.generate_channel_keys_id(false,0));
1955
1950
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
1951
let per_commitment_secret = SecretKey::from_slice(&<Vec<u8>>::from_hex("1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100").unwrap()[..]).unwrap();
1958
1952
let per_commitment_point = PublicKey::from_secret_key(&secp_ctx,&per_commitment_secret);
1959
-
let htlc_basepoint = &signer.pubkeys().htlc_basepoint;
1960
1953
let holder_pubkeys = signer.pubkeys();
1961
1954
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);
1963
1955
let channel_parameters = ChannelTransactionParameters{
0 commit comments