Skip to content
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
2 changes: 2 additions & 0 deletions ci/check-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -x
CLIPPY() {
# shellcheck disable=SC2086
RUSTFLAGS='-D warnings' cargo clippy $1 -- $2 \
`# https://github.com/rust-lang/rust-clippy/issues/15442` \
-A unused_imports \
`# Things clippy defaults to allowing but we should avoid` \
-D clippy::clone_on_ref_ptr \
`# Things where clippy is just wrong` \
Expand Down
3 changes: 1 addition & 2 deletions lightning-block-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ use bitcoin::hash_types::BlockHash;
use bitcoin::pow::Work;

use lightning::chain;
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
use lightning::chain::Listen as _;
use lightning::chain::Listen;

use std::future::Future;
use std::ops::Deref;
Expand Down
4 changes: 1 addition & 3 deletions lightning/src/chain/chainmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ use crate::chain::channelmonitor::{
WithChannelMonitor,
};
use crate::chain::transaction::{OutPoint, TransactionData};
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
use crate::chain::Filter as _;
use crate::chain::{ChannelMonitorUpdateStatus, WatchedOutput};
use crate::chain::{ChannelMonitorUpdateStatus, Filter, WatchedOutput};
use crate::events::{self, Event, EventHandler, ReplayEvent};
use crate::ln::channel_state::ChannelDetails;
use crate::ln::msgs::{self, BaseMessageHandler, Init, MessageSendEvent, SendOnlyMessageHandler};
Expand Down
3 changes: 1 addition & 2 deletions lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ use crate::chain::package::{
HolderHTLCOutput, PackageSolvingData, PackageTemplate, RevokedHTLCOutput, RevokedOutput,
};
use crate::chain::transaction::{OutPoint, TransactionData};
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
use crate::chain::Filter as _;
use crate::chain::Filter;
use crate::chain::{BestBlock, WatchedOutput};
use crate::events::bump_transaction::{AnchorDescriptor, BumpTransactionEvent};
use crate::events::{ClosureReason, Event, EventHandler, ReplayEvent};
Expand Down
22 changes: 13 additions & 9 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14136,6 +14136,7 @@ mod tests {
use crate::ln::script::ShutdownScript;
use crate::prelude::*;
use crate::routing::router::{Path, RouteHop};
#[cfg(ldk_test_vectors)]
use crate::sign::{ChannelSigner, EntropySource, InMemorySigner, SignerProvider};
#[cfg(splicing)]
use crate::sync::Mutex;
Expand All @@ -14156,8 +14157,7 @@ mod tests {
use bitcoin::hex::FromHex;
use bitcoin::locktime::absolute::LockTime;
use bitcoin::network::Network;
use bitcoin::opcodes;
use bitcoin::script::{Builder, ScriptBuf};
use bitcoin::script::Builder;
use bitcoin::secp256k1::ffi::Signature as FFISignature;
use bitcoin::secp256k1::{ecdsa::Signature, Secp256k1};
use bitcoin::secp256k1::{PublicKey, SecretKey};
Expand All @@ -14166,7 +14166,7 @@ mod tests {
use bitcoin::transaction::{Transaction, TxOut, Version};
#[cfg(splicing)]
use bitcoin::Weight;
use bitcoin::{WPubkeyHash, WitnessProgram, WitnessVersion};
use bitcoin::{WitnessProgram, WitnessVersion};
use std::cmp;

#[test]
Expand All @@ -14192,17 +14192,19 @@ mod tests {
);
}

#[allow(dead_code)]
#[cfg(ldk_test_vectors)]
struct Keys {
signer: InMemorySigner,
signer: crate::sign::InMemorySigner,
}

#[cfg(ldk_test_vectors)]
impl EntropySource for Keys {
fn get_secure_random_bytes(&self) -> [u8; 32] {
[0; 32]
}
}

#[cfg(ldk_test_vectors)]
impl SignerProvider for Keys {
type EcdsaSigner = InMemorySigner;
#[cfg(taproot)]
Expand All @@ -14216,16 +14218,18 @@ mod tests {
self.signer.clone()
}

fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> {
fn get_destination_script(
&self, _channel_keys_id: [u8; 32],
) -> Result<bitcoin::script::ScriptBuf, ()> {
let secp_ctx = Secp256k1::signing_only();
let hex = "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
let channel_monitor_claim_key =
SecretKey::from_slice(&<Vec<u8>>::from_hex(hex).unwrap()[..]).unwrap();
let channel_monitor_claim_key_hash = WPubkeyHash::hash(
let channel_monitor_claim_key_hash = bitcoin::WPubkeyHash::hash(
&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize(),
);
Ok(Builder::new()
.push_opcode(opcodes::all::OP_PUSHBYTES_0)
.push_opcode(bitcoin::opcodes::all::OP_PUSHBYTES_0)
.push_slice(channel_monitor_claim_key_hash)
.into_script())
}
Expand Down Expand Up @@ -15906,7 +15910,7 @@ mod tests {
fn funding_input_sats(input_value_sats: u64) -> (TxIn, Transaction, Weight) {
use crate::sign::P2WPKH_WITNESS_WEIGHT;

let input_1_prev_out = TxOut { value: Amount::from_sat(input_value_sats), script_pubkey: ScriptBuf::default() };
let input_1_prev_out = TxOut { value: Amount::from_sat(input_value_sats), script_pubkey: bitcoin::ScriptBuf::default() };
let input_1_prev_tx = Transaction {
input: vec![], output: vec![input_1_prev_out],
version: Version::TWO, lock_time: bitcoin::absolute::LockTime::ZERO,
Expand Down
4 changes: 1 addition & 3 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ use crate::chain::channelmonitor::{
LATENCY_GRACE_PERIOD_BLOCKS, MAX_BLOCKS_FOR_CONF,
};
use crate::chain::transaction::{OutPoint, TransactionData};
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
use crate::chain::Watch as _;
use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm};
use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Watch};
use crate::events::{
self, ClosureReason, Event, EventHandler, EventsProvider, HTLCHandlingFailureType,
InboundChannelFunds, PaymentFailureReason, ReplayEvent,
Expand Down