]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Remove unused NodeSigner implementations in tests
authorWilmer Paulino <wilmer.paulino@gmail.com>
Wed, 18 Jan 2023 20:28:42 +0000 (12:28 -0800)
committerWilmer Paulino <wilmer.paulino@gmail.com>
Thu, 19 Jan 2023 00:57:52 +0000 (16:57 -0800)
These implementations have every method panic, so assuming that the test
suite passes, these implementations are never used.

lightning/src/ln/channel.rs
lightning/src/util/test_utils.rs

index 5dbae1bbbb6924119a4a56c648362e31f99dc6d6..8b323a3a946532c0be374b8f19931c621e16ba61 100644 (file)
@@ -6807,22 +6807,19 @@ mod tests {
        use crate::ln::chan_utils::{htlc_success_tx_weight, htlc_timeout_tx_weight};
        use crate::chain::BestBlock;
        use crate::chain::chaininterface::{FeeEstimator, LowerBoundedFeeEstimator, ConfirmationTarget};
-       use crate::chain::keysinterface::{BaseSign, InMemorySigner, Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider};
+       use crate::chain::keysinterface::{BaseSign, InMemorySigner, EntropySource, SignerProvider};
        use crate::chain::transaction::OutPoint;
        use crate::util::config::UserConfig;
        use crate::util::enforcing_trait_impls::EnforcingSigner;
        use crate::util::errors::APIError;
        use crate::util::test_utils;
        use crate::util::test_utils::OnGetShutdownScriptpubkey;
-       use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature, Scalar};
+       use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
        use bitcoin::secp256k1::ffi::Signature as FFISignature;
        use bitcoin::secp256k1::{SecretKey,PublicKey};
-       use bitcoin::secp256k1::ecdh::SharedSecret;
-       use bitcoin::secp256k1::ecdsa::RecoverableSignature;
        use bitcoin::hashes::sha256::Hash as Sha256;
        use bitcoin::hashes::Hash;
        use bitcoin::hash_types::WPubkeyHash;
-       use bitcoin::bech32::u5;
        use bitcoin::PackedLockTime;
        use bitcoin::util::address::WitnessVersion;
        use crate::prelude::*;
@@ -6861,21 +6858,6 @@ mod tests {
                fn get_secure_random_bytes(&self) -> [u8; 32] { [0; 32] }
        }
 
-       impl NodeSigner for Keys {
-               fn get_node_secret(&self, _recipient: Recipient) -> Result<SecretKey, ()> { panic!(); }
-
-               fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
-                       let secp_ctx = Secp256k1::signing_only();
-                       Ok(PublicKey::from_secret_key(&secp_ctx, &self.get_node_secret(recipient)?))
-               }
-
-               fn ecdh(&self, _recipient: Recipient, _other_key: &PublicKey, _tweak: Option<&Scalar>) -> Result<SharedSecret, ()> { panic!(); }
-
-               fn get_inbound_payment_key_material(&self) -> KeyMaterial { panic!(); }
-
-               fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> { panic!(); }
-       }
-
        impl SignerProvider for Keys {
                type Signer = InMemorySigner;
 
index f528ae2d547c61f78c09fbbe64b2a3e3da6aa173..627ee54ebafa019363a432331e6bf3ac4064538f 100644 (file)
@@ -51,7 +51,7 @@ use crate::sync::{Mutex, Arc};
 use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
 use core::mem;
 use bitcoin::bech32::u5;
-use crate::chain::keysinterface::{InMemorySigner, Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider};
+use crate::chain::keysinterface::{InMemorySigner, Recipient, EntropySource, NodeSigner, SignerProvider};
 
 #[cfg(feature = "std")]
 use std::time::{SystemTime, UNIX_EPOCH};
@@ -107,17 +107,6 @@ pub struct OnlyReadsKeysInterface {}
 impl EntropySource for OnlyReadsKeysInterface {
        fn get_secure_random_bytes(&self) -> [u8; 32] { [0; 32] }}
 
-impl NodeSigner for OnlyReadsKeysInterface {
-       fn get_node_secret(&self, _recipient: Recipient) -> Result<SecretKey, ()> { unreachable!(); }
-       fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
-               let secp_ctx = Secp256k1::signing_only();
-               Ok(PublicKey::from_secret_key(&secp_ctx, &self.get_node_secret(recipient)?))
-       }
-       fn ecdh(&self, _recipient: Recipient, _other_key: &PublicKey, _tweak: Option<&Scalar>) -> Result<SharedSecret, ()> { unreachable!(); }
-       fn get_inbound_payment_key_material(&self) -> KeyMaterial { unreachable!(); }
-       fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> { unreachable!(); }
-}
-
 impl SignerProvider for OnlyReadsKeysInterface {
        type Signer = EnforcingSigner;