]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop `chan_utils` self-import
authorMatt Corallo <git@bluematt.me>
Fri, 29 Sep 2023 17:10:40 +0000 (17:10 +0000)
committerDuncan Dean <git@dunxen.dev>
Tue, 13 Aug 2024 11:26:57 +0000 (13:26 +0200)
There's no reason to `use` a module within that module to refer to
that module...

lightning/src/ln/chan_utils.rs

index 4d2572e895f1e12090877c233a740b771ba9daf4..6a31942069a0c5efd9a003fba67aae21a5c79d09 100644 (file)
@@ -41,7 +41,6 @@ use bitcoin::{secp256k1, Sequence, Witness};
 
 use crate::io;
 use core::cmp;
-use crate::ln::chan_utils;
 use crate::util::transaction_utils::sort_outputs;
 use crate::ln::channel::{INITIAL_COMMITMENT_NUMBER, ANCHOR_OUTPUT_VALUE_SATOSHI};
 use core::ops::Deref;
@@ -810,7 +809,7 @@ pub fn get_anchor_redeemscript(funding_pubkey: &PublicKey) -> ScriptBuf {
 
 /// Locates the output with an anchor script paying to `funding_pubkey` within `commitment_tx`.
 pub(crate) fn get_anchor_output<'a>(commitment_tx: &'a Transaction, funding_pubkey: &PublicKey) -> Option<(u32, &'a TxOut)> {
-       let anchor_script = chan_utils::get_anchor_redeemscript(funding_pubkey).to_p2wsh();
+       let anchor_script = get_anchor_redeemscript(funding_pubkey).to_p2wsh();
        commitment_tx.output.iter().enumerate()
                .find(|(_, txout)| txout.script_pubkey == anchor_script)
                .map(|(idx, txout)| (idx as u32, txout))
@@ -818,7 +817,7 @@ pub(crate) fn get_anchor_output<'a>(commitment_tx: &'a Transaction, funding_pubk
 
 /// Returns the witness required to satisfy and spend an anchor input.
 pub fn build_anchor_input_witness(funding_key: &PublicKey, funding_sig: &Signature) -> Witness {
-       let anchor_redeem_script = chan_utils::get_anchor_redeemscript(funding_key);
+       let anchor_redeem_script = get_anchor_redeemscript(funding_key);
        let mut ret = Witness::new();
        ret.push_ecdsa_signature(&BitcoinSignature::sighash_all(*funding_sig));
        ret.push(anchor_redeem_script.as_bytes());
@@ -1510,7 +1509,7 @@ impl CommitmentTransaction {
 
                let mut htlcs = Vec::with_capacity(htlcs_with_aux.len());
                for (htlc, _) in htlcs_with_aux {
-                       let script = chan_utils::get_htlc_redeemscript(&htlc, &channel_parameters.channel_type_features(), &keys);
+                       let script = get_htlc_redeemscript(&htlc, &channel_parameters.channel_type_features(), &keys);
                        let txout = TxOut {
                                script_pubkey: script.to_p2wsh(),
                                value: htlc.to_bitcoin_amount(),
@@ -1733,7 +1732,7 @@ impl<'a> TrustedCommitmentTransaction<'a> {
                        &self.inner.htlcs[htlc_index], &self.channel_type_features, &keys.broadcaster_htlc_key,
                        &keys.countersignatory_htlc_key, &keys.revocation_key
                );
-               chan_utils::build_htlc_input_witness(
+               build_htlc_input_witness(
                        signature, counterparty_signature, preimage, &htlc_redeemscript, &self.channel_type_features,
                )
        }