ChannelKeys - separate commitment revocation from getting the per-commitment point
[rust-lightning] / lightning / src / ln / chan_utils.rs
index 20ebc3520bfd670db5b71ed32b8b5577bf52d3ad..ba175733abeb632065d0cf16fe44ca13b6560b66 100644 (file)
@@ -52,7 +52,8 @@ impl HTLCType {
 // Various functions for key derivation and transaction creation for use within channels. Primarily
 // used in Channel and ChannelMonitor.
 
-pub(super) fn build_commitment_secret(commitment_seed: &[u8; 32], idx: u64) -> [u8; 32] {
+/// Build the commitment secret from the seed and the commitment number
+pub fn build_commitment_secret(commitment_seed: &[u8; 32], idx: u64) -> [u8; 32] {
        let mut res: [u8; 32] = commitment_seed.clone();
        for i in 0..48 {
                let bitpos = 47 - i;
@@ -496,8 +497,8 @@ pub fn build_htlc_transaction(prev_hash: &Txid, feerate_per_kw: u32, to_self_del
 
 #[derive(Clone)]
 /// We use this to track local commitment transactions and put off signing them until we are ready
-/// to broadcast. Eventually this will require a signer which is possibly external, but for now we
-/// just pass in the SecretKeys required.
+/// to broadcast. This class can be used inside a signer implementation to generate a signature
+/// given the relevant secret key.
 pub struct LocalCommitmentTransaction {
        // TODO: We should migrate away from providing the transaction, instead providing enough to
        // allow the ChannelKeys to construct it from scratch. Luckily we already have HTLC data here,