@@ -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,
@@ -8943,14 +8947,7 @@ where
8943
8947
pub fn best_block_updated<NS: Deref, L: Deref>(
8944
8948
&mut self, height: u32, highest_header_time: u32, chain_hash: ChainHash, node_signer: &NS,
8945
8949
user_config: &UserConfig, logger: &L,
8946
- ) -> Result<
8947
- (
8948
- Option<msgs::ChannelReady>,
8949
- Vec<(HTLCSource, PaymentHash)>,
8950
- Option<msgs::AnnouncementSignatures>,
8951
- ),
8952
- ClosureReason,
8953
- >
8950
+ ) -> Result<BestBlockUpdatedRes, ClosureReason>
8954
8951
where
8955
8952
NS::Target: NodeSigner,
8956
8953
L::Target: Logger,
@@ -12401,13 +12398,9 @@ mod tests {
12401
12398
12402
12399
fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> {
12403
12400
let secp_ctx = Secp256k1::signing_only();
12404
- let channel_monitor_claim_key = SecretKey::from_slice(
12405
- &<Vec<u8>>::from_hex(
12406
- "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
12407
- )
12408
- .unwrap()[..],
12409
- )
12410
- .unwrap();
12401
+ let hex = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
12402
+ let channel_monitor_claim_key =
12403
+ SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12411
12404
let channel_monitor_claim_key_hash = WPubkeyHash::hash(
12412
12405
&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize(),
12413
12406
);
@@ -12419,13 +12412,9 @@ mod tests {
12419
12412
12420
12413
fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> {
12421
12414
let secp_ctx = Secp256k1::signing_only();
12422
- let channel_close_key = SecretKey::from_slice(
12423
- &<Vec<u8>>::from_hex(
12424
- "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
12425
- )
12426
- .unwrap()[..],
12427
- )
12428
- .unwrap();
12415
+ let hex = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
12416
+ let channel_close_key =
12417
+ SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12429
12418
Ok(ShutdownScript::new_p2wpkh_from_pubkey(PublicKey::from_secret_key(
12430
12419
&secp_ctx,
12431
12420
&channel_close_key,
@@ -12438,10 +12427,8 @@ mod tests {
12438
12427
secp_ctx: &Secp256k1<bitcoin::secp256k1::All>, hex: &str,
12439
12428
) -> PublicKey {
12440
12429
assert!(cfg!(not(feature = "grind_signatures")));
12441
- PublicKey::from_secret_key(
12442
- &secp_ctx,
12443
- &SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap(),
12444
- )
12430
+ let secret = SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
12431
+ PublicKey::from_secret_key(&secp_ctx, &secret)
12445
12432
}
12446
12433
12447
12434
#[test]
0 commit comments