Skip to content

Commit aee9952

Browse files
committed
Remove unused NodeSigner implementations in tests
These implementations have every method panic, so assuming that the test suite passes, these implementations are never used.
1 parent f3a6ca4 commit aee9952

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6807,22 +6807,19 @@ mod tests {
68076807
use crate::ln::chan_utils::{htlc_success_tx_weight, htlc_timeout_tx_weight};
68086808
use crate::chain::BestBlock;
68096809
use crate::chain::chaininterface::{FeeEstimator, LowerBoundedFeeEstimator, ConfirmationTarget};
6810-
use crate::chain::keysinterface::{BaseSign, InMemorySigner, Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider};
6810+
use crate::chain::keysinterface::{BaseSign, InMemorySigner, EntropySource, SignerProvider};
68116811
use crate::chain::transaction::OutPoint;
68126812
use crate::util::config::UserConfig;
68136813
use crate::util::enforcing_trait_impls::EnforcingSigner;
68146814
use crate::util::errors::APIError;
68156815
use crate::util::test_utils;
68166816
use crate::util::test_utils::OnGetShutdownScriptpubkey;
6817-
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature, Scalar};
6817+
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
68186818
use bitcoin::secp256k1::ffi::Signature as FFISignature;
68196819
use bitcoin::secp256k1::{SecretKey,PublicKey};
6820-
use bitcoin::secp256k1::ecdh::SharedSecret;
6821-
use bitcoin::secp256k1::ecdsa::RecoverableSignature;
68226820
use bitcoin::hashes::sha256::Hash as Sha256;
68236821
use bitcoin::hashes::Hash;
68246822
use bitcoin::hash_types::WPubkeyHash;
6825-
use bitcoin::bech32::u5;
68266823
use bitcoin::PackedLockTime;
68276824
use bitcoin::util::address::WitnessVersion;
68286825
use crate::prelude::*;
@@ -6861,21 +6858,6 @@ mod tests {
68616858
fn get_secure_random_bytes(&self) -> [u8; 32] { [0; 32] }
68626859
}
68636860

6864-
impl NodeSigner for Keys {
6865-
fn get_node_secret(&self, _recipient: Recipient) -> Result<SecretKey, ()> { panic!(); }
6866-
6867-
fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
6868-
let secp_ctx = Secp256k1::signing_only();
6869-
Ok(PublicKey::from_secret_key(&secp_ctx, &self.get_node_secret(recipient)?))
6870-
}
6871-
6872-
fn ecdh(&self, _recipient: Recipient, _other_key: &PublicKey, _tweak: Option<&Scalar>) -> Result<SharedSecret, ()> { panic!(); }
6873-
6874-
fn get_inbound_payment_key_material(&self) -> KeyMaterial { panic!(); }
6875-
6876-
fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> { panic!(); }
6877-
}
6878-
68796861
impl SignerProvider for Keys {
68806862
type Signer = InMemorySigner;
68816863

lightning/src/util/test_utils.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use crate::sync::{Mutex, Arc};
5151
use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
5252
use core::mem;
5353
use bitcoin::bech32::u5;
54-
use crate::chain::keysinterface::{InMemorySigner, Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider};
54+
use crate::chain::keysinterface::{InMemorySigner, Recipient, EntropySource, NodeSigner, SignerProvider};
5555

5656
#[cfg(feature = "std")]
5757
use std::time::{SystemTime, UNIX_EPOCH};
@@ -107,17 +107,6 @@ pub struct OnlyReadsKeysInterface {}
107107
impl EntropySource for OnlyReadsKeysInterface {
108108
fn get_secure_random_bytes(&self) -> [u8; 32] { [0; 32] }}
109109

110-
impl NodeSigner for OnlyReadsKeysInterface {
111-
fn get_node_secret(&self, _recipient: Recipient) -> Result<SecretKey, ()> { unreachable!(); }
112-
fn get_node_id(&self, recipient: Recipient) -> Result<PublicKey, ()> {
113-
let secp_ctx = Secp256k1::signing_only();
114-
Ok(PublicKey::from_secret_key(&secp_ctx, &self.get_node_secret(recipient)?))
115-
}
116-
fn ecdh(&self, _recipient: Recipient, _other_key: &PublicKey, _tweak: Option<&Scalar>) -> Result<SharedSecret, ()> { unreachable!(); }
117-
fn get_inbound_payment_key_material(&self) -> KeyMaterial { unreachable!(); }
118-
fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> { unreachable!(); }
119-
}
120-
121110
impl SignerProvider for OnlyReadsKeysInterface {
122111
type Signer = EnforcingSigner;
123112

0 commit comments

Comments
 (0)