Skip to content

Commit a6f5df6

Browse files
committed
Respond to comments. Thanks @wpaulino!
1 parent 4c05087 commit a6f5df6

File tree

6 files changed

+43
-43
lines changed

6 files changed

+43
-43
lines changed

lightning-invoice/src/payment.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use core::time::Duration;
3232
/// with the same [`PaymentHash`] is never sent.
3333
///
3434
/// If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
35-
pub fn pay_invoice<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
35+
pub fn pay_invoice<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
3636
invoice: &Bolt11Invoice, retry_strategy: Retry,
3737
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>
3838
) -> Result<PaymentId, PaymentError>
@@ -61,7 +61,7 @@ where
6161
/// [`PaymentHash`] has never been paid before.
6262
///
6363
/// See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
64-
pub fn pay_invoice_with_id<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
64+
pub fn pay_invoice_with_id<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
6565
invoice: &Bolt11Invoice, payment_id: PaymentId, retry_strategy: Retry,
6666
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>
6767
) -> Result<(), PaymentError>
@@ -88,7 +88,7 @@ where
8888
///
8989
/// If you wish to use a different payment idempotency token, see
9090
/// [`pay_zero_value_invoice_with_id`].
91-
pub fn pay_zero_value_invoice<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
91+
pub fn pay_zero_value_invoice<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
9292
invoice: &Bolt11Invoice, amount_msats: u64, retry_strategy: Retry,
9393
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>
9494
) -> Result<PaymentId, PaymentError>
@@ -119,7 +119,7 @@ where
119119
///
120120
/// See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
121121
/// idempotency token.
122-
pub fn pay_zero_value_invoice_with_id<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
122+
pub fn pay_zero_value_invoice_with_id<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
123123
invoice: &Bolt11Invoice, amount_msats: u64, payment_id: PaymentId, retry_strategy: Retry,
124124
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>
125125
) -> Result<(), PaymentError>
@@ -191,7 +191,7 @@ trait Payer {
191191
) -> Result<(), PaymentError>;
192192
}
193193

194-
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref> Payer for ChannelManager<M, T, ES, NS, SP, F, R, L>
194+
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref> Payer for ChannelManager<M, T, ES, NS, SP, F, R, L>
195195
where
196196
M::Target: chain::Watch<<SP::Target as SignerProvider>::Signer>,
197197
T::Target: BroadcasterInterface,

lightning-invoice/src/utils.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn rotate_through_iterators<T, I: Iterator<Item = T>>(mut vecs: Vec<I>) -> impl
329329
/// confirmations during routing.
330330
///
331331
/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
332-
pub fn create_invoice_from_channelmanager<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
332+
pub fn create_invoice_from_channelmanager<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
333333
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
334334
network: Currency, amt_msat: Option<u64>, description: String, invoice_expiry_delta_secs: u32,
335335
min_final_cltv_expiry_delta: Option<u16>,
@@ -370,7 +370,7 @@ where
370370
/// confirmations during routing.
371371
///
372372
/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
373-
pub fn create_invoice_from_channelmanager_with_description_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
373+
pub fn create_invoice_from_channelmanager_with_description_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
374374
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
375375
network: Currency, amt_msat: Option<u64>, description_hash: Sha256,
376376
invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option<u16>,
@@ -400,7 +400,7 @@ where
400400
/// See [`create_invoice_from_channelmanager_with_description_hash`]
401401
/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
402402
/// available and the current time is supplied by the caller.
403-
pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
403+
pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
404404
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
405405
network: Currency, amt_msat: Option<u64>, description_hash: Sha256,
406406
duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option<u16>,
@@ -425,7 +425,7 @@ pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_sin
425425
/// See [`create_invoice_from_channelmanager`]
426426
/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
427427
/// available and the current time is supplied by the caller.
428-
pub fn create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
428+
pub fn create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
429429
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
430430
network: Currency, amt_msat: Option<u64>, description: String, duration_since_epoch: Duration,
431431
invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option<u16>,
@@ -449,7 +449,7 @@ pub fn create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T:
449449
)
450450
}
451451

452-
fn _create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
452+
fn _create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
453453
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
454454
network: Currency, amt_msat: Option<u64>, description: Bolt11InvoiceDescription,
455455
duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option<u16>,
@@ -482,7 +482,7 @@ fn _create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Der
482482
/// This version allows for providing a custom [`PaymentHash`] for the invoice.
483483
/// This may be useful if you're building an on-chain swap or involving another protocol where
484484
/// the payment hash is also involved outside the scope of lightning.
485-
pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
485+
pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
486486
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
487487
network: Currency, amt_msat: Option<u64>, description: String, duration_since_epoch: Duration,
488488
invoice_expiry_delta_secs: u32, payment_hash: PaymentHash, min_final_cltv_expiry_delta: Option<u16>,
@@ -511,7 +511,7 @@ pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_
511511
)
512512
}
513513

514-
fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref + Clone, F: Deref, R: Deref, L: Deref>(
514+
fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>(
515515
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>, node_signer: NS, logger: L,
516516
network: Currency, amt_msat: Option<u64>, description: Bolt11InvoiceDescription,
517517
duration_since_epoch: Duration, invoice_expiry_delta_secs: u32, payment_hash: PaymentHash,

lightning/src/ln/channel.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,7 @@ impl<SP: Deref> Channel<SP> where
24912491
/// Handles a funding_signed message from the remote end.
24922492
/// If this call is successful, broadcast the funding transaction (and not before!)
24932493
pub fn funding_signed<L: Deref>(
2494-
&mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: SP, logger: &L
2494+
&mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP, logger: &L
24952495
) -> Result<ChannelMonitor<<SP::Target as SignerProvider>::Signer>, ChannelError>
24962496
where
24972497
L::Target: Logger
@@ -4152,7 +4152,7 @@ impl<SP: Deref> Channel<SP> where
41524152
}
41534153

41544154
pub fn shutdown(
4155-
&mut self, signer_provider: SP, their_features: &InitFeatures, msg: &msgs::Shutdown
4155+
&mut self, signer_provider: &SP, their_features: &InitFeatures, msg: &msgs::Shutdown
41564156
) -> Result<(Option<msgs::Shutdown>, Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>), ChannelError>
41574157
{
41584158
if self.context.channel_state & (ChannelState::PeerDisconnected as u32) == ChannelState::PeerDisconnected as u32 {
@@ -5390,7 +5390,7 @@ impl<SP: Deref> Channel<SP> where
53905390
///
53915391
/// May jump to the channel being fully shutdown (see [`Self::is_shutdown`]) in which case no
53925392
/// [`ChannelMonitorUpdate`] will be returned).
5393-
pub fn get_shutdown(&mut self, signer_provider: SP, their_features: &InitFeatures,
5393+
pub fn get_shutdown(&mut self, signer_provider: &SP, their_features: &InitFeatures,
53945394
target_feerate_sats_per_kw: Option<u32>, override_shutdown_script: Option<ShutdownScript>)
53955395
-> Result<(msgs::Shutdown, Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>), APIError>
53965396
{
@@ -5511,7 +5511,7 @@ pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider
55115511

55125512
impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
55135513
pub fn new<ES: Deref, F: Deref>(
5514-
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: SP, counterparty_node_id: PublicKey, their_features: &InitFeatures,
5514+
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP, counterparty_node_id: PublicKey, their_features: &InitFeatures,
55155515
channel_value_satoshis: u64, push_msat: u64, user_id: u128, config: &UserConfig, current_chain_height: u32,
55165516
outbound_scid_alias: u64
55175517
) -> Result<OutboundV1Channel<SP>, APIError>
@@ -6020,7 +6020,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
60206020
/// Creates a new channel from a remote sides' request for one.
60216021
/// Assumes chain_hash has already been checked and corresponds with what we expect!
60226022
pub fn new<ES: Deref, F: Deref, L: Deref>(
6023-
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: SP,
6023+
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
60246024
counterparty_node_id: PublicKey, our_supported_features: &ChannelTypeFeatures,
60256025
their_features: &InitFeatures, msg: &msgs::OpenChannel, user_id: u128, config: &UserConfig,
60266026
current_chain_height: u32, logger: &L, outbound_scid_alias: u64
@@ -6457,7 +6457,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
64576457
}
64586458

64596459
pub fn funding_created<L: Deref>(
6460-
mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: SP, logger: &L
6460+
mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: &SP, logger: &L
64616461
) -> Result<(Channel<SP>, msgs::FundingSigned, ChannelMonitor<<SP::Target as SignerProvider>::Signer>), (Self, ChannelError)>
64626462
where
64636463
L::Target: Logger
@@ -7580,7 +7580,7 @@ mod tests {
75807580

75817581
let node_a_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
75827582
let config = UserConfig::default();
7583-
let node_a_chan = OutboundV1Channel::<&TestKeysInterface>::new(&bounded_fee_estimator, &&keys_provider, &keys_provider, node_a_node_id, &channelmanager::provided_init_features(&config), 10000000, 100000, 42, &config, 0, 42).unwrap();
7583+
let node_a_chan = OutboundV1Channel::<&TestKeysInterface>::new(&bounded_fee_estimator, &&keys_provider, &&keys_provider, node_a_node_id, &channelmanager::provided_init_features(&config), 10000000, 100000, 42, &config, 0, 42).unwrap();
75847584

75857585
// Now change the fee so we can check that the fee in the open_channel message is the
75867586
// same as the old fee.

0 commit comments

Comments
 (0)