Skip to content

Commit ddf3ec6

Browse files
committed
Substitute 'KeysInterface' generic parameter with one of its comprising traits where a singular substitution is possible.
1 parent a9003c6 commit ddf3ec6

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ mod tests {
16351635
use crate::ln::chan_utils::{get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction, TxCreationKeys, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, HTLCOutputInCommitment};
16361636
use bitcoin::secp256k1::{PublicKey, SecretKey, Secp256k1};
16371637
use crate::util::test_utils;
1638-
use crate::chain::keysinterface::{KeysInterface, BaseSign, SignerProvider};
1638+
use crate::chain::keysinterface::{BaseSign, SignerProvider};
16391639
use bitcoin::{Network, Txid};
16401640
use bitcoin::hashes::Hash;
16411641
use crate::ln::PaymentHash;

lightning/src/ln/onion_route_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! returned errors decode to the correct thing.
1313
1414
use crate::chain::channelmonitor::{CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS};
15-
use crate::chain::keysinterface::{EntropySource, KeysInterface, NodeSigner, Recipient};
15+
use crate::chain::keysinterface::{EntropySource, NodeSigner, Recipient};
1616
use crate::ln::{PaymentHash, PaymentSecret};
1717
use crate::ln::channel::EXPIRE_PREV_CONFIG_TICKS;
1818
use crate::ln::channelmanager::{self, HTLCForwardInfo, CLTV_FAR_FAR_AWAY, MIN_CLTV_EXPIRY_DELTA, PendingAddHTLCInfo, PendingHTLCInfo, PendingHTLCRouting, PaymentId};

lightning/src/ln/shutdown_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
//! Tests of our shutdown and closing_signed negotiation logic.
1111
12-
use crate::chain::keysinterface::{EntropySource, KeysInterface, SignerProvider};
12+
use crate::chain::keysinterface::{EntropySource, SignerProvider};
1313
use crate::chain::transaction::OutPoint;
1414
use crate::ln::channelmanager::{self, PaymentSendFailure, PaymentId};
1515
use crate::routing::router::{PaymentParameters, get_route};

lightning/src/routing/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ mod tests {
21392139
use crate::routing::scoring::{ChannelUsage, Score, ProbabilisticScorer, ProbabilisticScoringParameters};
21402140
use crate::routing::test_utils::{add_channel, add_or_update_node, build_graph, build_line_graph, id_to_feature_flags, get_nodes, update_channel};
21412141
use crate::chain::transaction::OutPoint;
2142-
use crate::chain::keysinterface::{EntropySource, KeysInterface};
2142+
use crate::chain::keysinterface::EntropySource;
21432143
use crate::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
21442144
use crate::ln::msgs::{ErrorAction, LightningError, UnsignedChannelUpdate, MAX_VALUE_MSAT};
21452145
use crate::ln::channelmanager;
@@ -5653,7 +5653,7 @@ mod benches {
56535653
use bitcoin::hashes::Hash;
56545654
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
56555655
use crate::chain::transaction::OutPoint;
5656-
use crate::chain::keysinterface::{EntropySource, KeysManager,KeysInterface};
5656+
use crate::chain::keysinterface::{EntropySource, KeysManager};
56575657
use crate::ln::channelmanager::{self, ChannelCounterparty, ChannelDetails};
56585658
use crate::ln::features::InvoiceFeatures;
56595659
use crate::routing::gossip::NetworkGraph;

lightning/src/routing/scoring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//! # use lightning::routing::gossip::NetworkGraph;
2121
//! # use lightning::routing::router::{RouteParameters, find_route};
2222
//! # use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters};
23-
//! # use lightning::chain::keysinterface::{KeysManager, KeysInterface};
23+
//! # use lightning::chain::keysinterface::KeysManager;
2424
//! # use lightning::util::logger::{Logger, Record};
2525
//! # use bitcoin::secp256k1::PublicKey;
2626
//! #

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl Writeable for EnforcingSigner {
239239
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
240240
// EnforcingSigner has two fields - `inner` ([`InMemorySigner`]) and `state`
241241
// ([`EnforcementState`]). `inner` is serialized here and deserialized by
242-
// [`KeysInterface::read_chan_signer`]. `state` is managed by [`KeysInterface`]
242+
// [`SignerProvider::read_chan_signer`]. `state` is managed by [`SignerProvider`]
243243
// and will be serialized as needed by the implementation of that trait.
244244
self.inner.write(writer)?;
245245
Ok(())

lightning/src/util/scid_utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn scid_from_parts(block: u64, tx_index: u64, vout_index: u64) -> Result<u64
6868
pub(crate) mod fake_scid {
6969
use bitcoin::hash_types::BlockHash;
7070
use bitcoin::hashes::hex::FromHex;
71-
use crate::chain::keysinterface::{KeysInterface, EntropySource};
71+
use crate::chain::keysinterface::EntropySource;
7272
use crate::util::chacha20::ChaCha20;
7373
use crate::util::scid_utils;
7474

@@ -101,13 +101,13 @@ pub(crate) mod fake_scid {
101101
/// between segwit activation and the current best known height, and the tx index and output
102102
/// index are also selected from a "reasonable" range. We add this logic because it makes it
103103
/// non-obvious at a glance that the scid is fake, e.g. if it appears in invoice route hints.
104-
pub(crate) fn get_fake_scid<K: Deref>(&self, highest_seen_blockheight: u32, genesis_hash: &BlockHash, fake_scid_rand_bytes: &[u8; 32], keys_manager: &K) -> u64
105-
where K::Target: KeysInterface,
104+
pub(crate) fn get_fake_scid<ES: Deref>(&self, highest_seen_blockheight: u32, genesis_hash: &BlockHash, fake_scid_rand_bytes: &[u8; 32], entropy_source: &ES) -> u64
105+
where ES::Target: EntropySource,
106106
{
107107
// Ensure we haven't created a namespace that doesn't fit into the 3 bits we've allocated for
108108
// namespaces.
109109
assert!((*self as u8) < MAX_NAMESPACES);
110-
let rand_bytes = keys_manager.get_secure_random_bytes();
110+
let rand_bytes = entropy_source.get_secure_random_bytes();
111111

112112
let segwit_activation_height = segwit_activation_height(genesis_hash);
113113
let mut blocks_since_segwit_activation = highest_seen_blockheight.saturating_sub(segwit_activation_height);

0 commit comments

Comments
 (0)