@@ -1308,9 +1308,8 @@ impl HolderCommitmentPoint {
1308
1308
L::Target: Logger,
1309
1309
{
1310
1310
if let HolderCommitmentPoint::PendingNext { transaction_number, current } = self {
1311
- if let Ok(next) =
1312
- signer.as_ref().get_per_commitment_point(*transaction_number - 1, secp_ctx)
1313
- {
1311
+ let next = signer.as_ref().get_per_commitment_point(*transaction_number - 1, secp_ctx);
1312
+ if let Ok(next) = next {
1314
1313
log_trace!(
1315
1314
logger,
1316
1315
"Retrieved next per-commitment point {}",
@@ -2056,10 +2055,8 @@ impl FundingScope {
2056
2055
}
2057
2056
2058
2057
pub fn get_counterparty_selected_contest_delay(&self) -> Option<u16> {
2059
- self.channel_transaction_parameters
2060
- .counterparty_parameters
2061
- .as_ref()
2062
- .map(|params| params.selected_contest_delay)
2058
+ let params_opt = self.channel_transaction_parameters.counterparty_parameters.as_ref();
2059
+ params_opt.map(|params| params.selected_contest_delay)
2063
2060
}
2064
2061
2065
2062
fn get_counterparty_pubkeys(&self) -> &ChannelPublicKeys {
@@ -5496,9 +5493,10 @@ fn get_holder_max_htlc_value_in_flight_msat(
5496
5493
pub(crate) fn get_holder_selected_channel_reserve_satoshis(
5497
5494
channel_value_satoshis: u64, config: &UserConfig,
5498
5495
) -> u64 {
5499
- let calculated_reserve = channel_value_satoshis.saturating_mul(
5500
- config.channel_handshake_config.their_channel_reserve_proportional_millionths as u64,
5501
- ) / 1_000_000;
5496
+ let counterparty_chan_reserve_prop_mil =
5497
+ config.channel_handshake_config.their_channel_reserve_proportional_millionths as u64;
5498
+ let calculated_reserve =
5499
+ channel_value_satoshis.saturating_mul(counterparty_chan_reserve_prop_mil) / 1_000_000;
5502
5500
cmp::min(channel_value_satoshis, cmp::max(calculated_reserve, MIN_THEIR_CHAN_RESERVE_SATOSHIS))
5503
5501
}
5504
5502
@@ -5736,6 +5734,12 @@ impl FailHTLCMessageName for msgs::UpdateFailMalformedHTLC {
5736
5734
}
5737
5735
}
5738
5736
5737
+ type BestBlockUpdatedRes = (
5738
+ Option<msgs::ChannelReady>,
5739
+ Vec<(HTLCSource, PaymentHash)>,
5740
+ Option<msgs::AnnouncementSignatures>,
5741
+ );
5742
+
5739
5743
impl<SP: Deref> FundedChannel<SP>
5740
5744
where
5741
5745
SP::Target: SignerProvider,
@@ -8946,14 +8950,7 @@ where
8946
8950
pub fn best_block_updated<NS: Deref, L: Deref>(
8947
8951
&mut self, height: u32, highest_header_time: u32, chain_hash: ChainHash, node_signer: &NS,
8948
8952
user_config: &UserConfig, logger: &L,
8949
- ) -> Result<
8950
- (
8951
- Option<msgs::ChannelReady>,
8952
- Vec<(HTLCSource, PaymentHash)>,
8953
- Option<msgs::AnnouncementSignatures>,
8954
- ),
8955
- ClosureReason,
8956
- >
8953
+ ) -> Result<BestBlockUpdatedRes, ClosureReason>
8957
8954
where
8958
8955
NS::Target: NodeSigner,
8959
8956
L::Target: Logger,
@@ -12404,13 +12401,9 @@ mod tests {
12404
12401
12405
12402
fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> {
12406
12403
let secp_ctx = Secp256k1::signing_only();
12407
- let channel_monitor_claim_key = SecretKey::from_slice(
12408
- &<Vec<u8>>::from_hex(
12409
- "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
12410
- )
12411
- .unwrap()[..],
12412
- )
12413
- .unwrap();
12404
+ let hex = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
12405
+ let channel_monitor_claim_key =
12406
+ SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12414
12407
let channel_monitor_claim_key_hash = WPubkeyHash::hash(
12415
12408
&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize(),
12416
12409
);
@@ -12422,13 +12415,9 @@ mod tests {
12422
12415
12423
12416
fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> {
12424
12417
let secp_ctx = Secp256k1::signing_only();
12425
- let channel_close_key = SecretKey::from_slice(
12426
- &<Vec<u8>>::from_hex(
12427
- "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
12428
- )
12429
- .unwrap()[..],
12430
- )
12431
- .unwrap();
12418
+ let hex = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
12419
+ let channel_close_key =
12420
+ SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12432
12421
Ok(ShutdownScript::new_p2wpkh_from_pubkey(PublicKey::from_secret_key(
12433
12422
&secp_ctx,
12434
12423
&channel_close_key,
@@ -12441,10 +12430,8 @@ mod tests {
12441
12430
secp_ctx: &Secp256k1<bitcoin::secp256k1::All>, hex: &str,
12442
12431
) -> PublicKey {
12443
12432
assert!(cfg!(not(feature = "grind_signatures")));
12444
- PublicKey::from_secret_key(
12445
- &secp_ctx,
12446
- &SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap(),
12447
- )
12433
+ let secret = SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12434
+ PublicKey::from_secret_key(&secp_ctx, &secret)
12448
12435
}
12449
12436
12450
12437
#[test]
0 commit comments