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(0,0,0,keys,0, nondust_htlcs.iter_mut(),&channel_parameters.as_counterparty_broadcastable());
1132
+
let inner = CommitmentTransaction::new(0,&dummy_key.clone(),0,0,0, nondust_htlcs.iter_mut(),&channel_parameters.as_counterparty_broadcastable(),&secp_ctx);
use bitcoin::secp256k1::{self,PublicKey,SecretKey,Secp256k1};
1901
1895
usecrate::util::test_utils;
1902
1896
usecrate::sign::{ChannelSigner,SignerProvider};
1903
1897
use bitcoin::{Network,Txid,ScriptBuf,CompressedPublicKey};
@@ -1912,11 +1906,12 @@ mod tests {
1912
1906
1913
1907
structTestCommitmentTxBuilder{
1914
1908
commitment_number:u64,
1915
-
keys:TxCreationKeys,
1909
+
per_commitment_point:PublicKey,
1916
1910
feerate_per_kw:u32,
1917
1911
nondust_htlcs:Vec<HTLCOutputInCommitment>,
1918
1912
channel_parameters:ChannelTransactionParameters,
1919
1913
counterparty_pubkeys:ChannelPublicKeys,
1914
+
secp_ctx:Secp256k1::<secp256k1::All>,
1920
1915
}
1921
1916
1922
1917
implTestCommitmentTxBuilder{
@@ -1927,13 +1922,10 @@ mod tests {
1927
1922
let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
1928
1923
let signer = keys_provider.derive_channel_signer(3000, keys_provider.generate_channel_keys_id(false,1_000_000,0));
1929
1924
let counterparty_signer = keys_provider.derive_channel_signer(3000, keys_provider.generate_channel_keys_id(true,1_000_000,1));
1930
-
let delayed_payment_base = &signer.pubkeys().delayed_payment_basepoint;
1931
1925
let per_commitment_secret = SecretKey::from_slice(&<Vec<u8>>::from_hex("1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100").unwrap()[..]).unwrap();
1932
1926
let per_commitment_point = PublicKey::from_secret_key(&secp_ctx,&per_commitment_secret);
1933
-
let htlc_basepoint = &signer.pubkeys().htlc_basepoint;
1934
1927
let holder_pubkeys = signer.pubkeys();
1935
1928
let counterparty_pubkeys = counterparty_signer.pubkeys().clone();
1936
-
let keys = TxCreationKeys::derive_new(&secp_ctx,&per_commitment_point, delayed_payment_base, htlc_basepoint,&counterparty_pubkeys.revocation_basepoint,&counterparty_pubkeys.htlc_basepoint);
1937
1929
let channel_parameters = ChannelTransactionParameters{
0 commit comments