Skip to content

Fix build warnings #2374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lightning/src/chain/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl Readable for CounterpartyOfferedHTLCOutput {
let mut counterparty_htlc_base_key = RequiredWrapper(None);
let mut preimage = RequiredWrapper(None);
let mut htlc = RequiredWrapper(None);
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;

read_tlv_fields!(reader, {
Expand All @@ -256,7 +256,7 @@ impl Readable for CounterpartyOfferedHTLCOutput {
(4, counterparty_htlc_base_key, required),
(6, preimage, required),
(8, htlc, required),
(10, legacy_deserialization_prevention_marker, option),
(10, _legacy_deserialization_prevention_marker, option),
(11, channel_type_features, option),
});

Expand Down Expand Up @@ -321,15 +321,15 @@ impl Readable for CounterpartyReceivedHTLCOutput {
let mut counterparty_delayed_payment_base_key = RequiredWrapper(None);
let mut counterparty_htlc_base_key = RequiredWrapper(None);
let mut htlc = RequiredWrapper(None);
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;

read_tlv_fields!(reader, {
(0, per_commitment_point, required),
(2, counterparty_delayed_payment_base_key, required),
(4, counterparty_htlc_base_key, required),
(6, htlc, required),
(8, legacy_deserialization_prevention_marker, option),
(8, _legacy_deserialization_prevention_marker, option),
(9, channel_type_features, option),
});

Expand Down Expand Up @@ -399,14 +399,14 @@ impl Readable for HolderHTLCOutput {
let mut amount_msat = RequiredWrapper(None);
let mut cltv_expiry = RequiredWrapper(None);
let mut preimage = None;
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;

read_tlv_fields!(reader, {
(0, amount_msat, required),
(2, cltv_expiry, required),
(4, preimage, option),
(6, legacy_deserialization_prevention_marker, option),
(6, _legacy_deserialization_prevention_marker, option),
(7, channel_type_features, option),
});

Expand Down Expand Up @@ -460,14 +460,14 @@ impl Writeable for HolderFundingOutput {
impl Readable for HolderFundingOutput {
fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
let mut funding_redeemscript = RequiredWrapper(None);
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;
let mut funding_amount = None;

read_tlv_fields!(reader, {
(0, funding_redeemscript, required),
(1, channel_type_features, option),
(2, legacy_deserialization_prevention_marker, option),
(2, _legacy_deserialization_prevention_marker, option),
(3, funding_amount, option)
});

Expand Down
8 changes: 4 additions & 4 deletions lightning/src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ impl Readable for ChannelTransactionParameters {
let mut is_outbound_from_holder = RequiredWrapper(None);
let mut counterparty_parameters = None;
let mut funding_outpoint = None;
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;

read_tlv_fields!(reader, {
Expand All @@ -947,7 +947,7 @@ impl Readable for ChannelTransactionParameters {
(4, is_outbound_from_holder, required),
(6, counterparty_parameters, option),
(8, funding_outpoint, option),
(10, legacy_deserialization_prevention_marker, option),
(10, _legacy_deserialization_prevention_marker, option),
(11, channel_type_features, option),
});

Expand Down Expand Up @@ -1363,7 +1363,7 @@ impl Readable for CommitmentTransaction {
let mut keys = RequiredWrapper(None);
let mut built = RequiredWrapper(None);
_init_tlv_field_var!(htlcs, vec_type);
let mut legacy_deserialization_prevention_marker: Option<()> = None;
let mut _legacy_deserialization_prevention_marker: Option<()> = None;
let mut channel_type_features = None;

read_tlv_fields!(reader, {
Expand All @@ -1374,7 +1374,7 @@ impl Readable for CommitmentTransaction {
(8, keys, required),
(10, built, required),
(12, htlcs, vec_type),
(14, legacy_deserialization_prevention_marker, option),
(14, _legacy_deserialization_prevention_marker, option),
(15, channel_type_features, option),
});

Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7405,7 +7405,7 @@ mod tests {
}
}

#[cfg(not(feature = "grind_signatures"))]
#[cfg(all(feature = "_test_vectors", not(feature = "grind_signatures")))]
fn public_from_secret_hex(secp_ctx: &Secp256k1<bitcoin::secp256k1::All>, hex: &str) -> PublicKey {
PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&hex::decode(hex).unwrap()[..]).unwrap())
}
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl core::hash::Hash for HTLCSource {
}
}
impl HTLCSource {
#[cfg(not(feature = "grind_signatures"))]
#[cfg(all(feature = "_test_vectors", not(feature = "grind_signatures")))]
#[cfg(test)]
pub fn dummy() -> Self {
HTLCSource::OutboundRoute {
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/reload_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
persister = test_utils::TestPersister::new();
let keys_manager = &chanmon_cfgs[0].keys_manager;
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister, keys_manager);
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster, &logger, &fee_estimator, &persister, keys_manager);
nodes[0].chain_monitor = &new_chain_monitor;


Expand Down
4 changes: 2 additions & 2 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl Readable for Route {
let blinded_tails = blinded_tails.unwrap_or(Vec::new());
if blinded_tails.len() != 0 {
if blinded_tails.len() != paths.len() { return Err(DecodeError::InvalidValue) }
for (mut path, blinded_tail_opt) in paths.iter_mut().zip(blinded_tails.into_iter()) {
for (path, blinded_tail_opt) in paths.iter_mut().zip(blinded_tails.into_iter()) {
path.blinded_tail = blinded_tail_opt;
}
}
Expand Down Expand Up @@ -1221,7 +1221,7 @@ impl<'a> PaymentPath<'a> {
cur_hop_fees_msat = self.hops.get(i + 1).unwrap().0.hop_use_fee_msat;
}

let mut cur_hop = &mut self.hops.get_mut(i).unwrap().0;
let cur_hop = &mut self.hops.get_mut(i).unwrap().0;
cur_hop.next_hops_fee_msat = total_fee_paid_msat;
// Overpay in fees if we can't save these funds due to htlc_minimum_msat.
// We try to account for htlc_minimum_msat in scoring (add_entry!), so that nodes don't
Expand Down