Skip to content

Commit 1e09974

Browse files
committed
Fix build warnings without grind_signatures
1 parent dfd6a1b commit 1e09974

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

lightning/src/ln/channel.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6289,44 +6289,39 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
62896289

62906290
#[cfg(test)]
62916291
mod tests {
6292-
use bitcoin::util::bip143;
6293-
use bitcoin::consensus::encode::serialize;
62946292
use bitcoin::blockdata::script::{Script, Builder};
6295-
use bitcoin::blockdata::transaction::{Transaction, TxOut, SigHashType};
6293+
use bitcoin::blockdata::transaction::{Transaction, TxOut};
62966294
use bitcoin::blockdata::constants::genesis_block;
62976295
use bitcoin::blockdata::opcodes;
62986296
use bitcoin::network::constants::Network;
6299-
use bitcoin::hashes::hex::FromHex;
63006297
use hex;
6301-
use ln::{PaymentPreimage, PaymentHash};
6298+
use ln::PaymentHash;
63026299
use ln::channelmanager::{HTLCSource, PaymentId};
6303-
use ln::channel::{Channel,InboundHTLCOutput,OutboundHTLCOutput,InboundHTLCState,OutboundHTLCState,HTLCOutputInCommitment,HTLCCandidate,HTLCInitiator,TxCreationKeys};
6300+
use ln::channel::{Channel, InboundHTLCOutput, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator};
63046301
use ln::channel::MAX_FUNDING_SATOSHIS;
63056302
use ln::features::InitFeatures;
63066303
use ln::msgs::{ChannelUpdate, DataLossProtect, DecodeError, OptionalField, UnsignedChannelUpdate};
63076304
use ln::script::ShutdownScript;
63086305
use ln::chan_utils;
6309-
use ln::chan_utils::{ChannelPublicKeys, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters, htlc_success_tx_weight, htlc_timeout_tx_weight};
6306+
use ln::chan_utils::{htlc_success_tx_weight, htlc_timeout_tx_weight};
63106307
use chain::BestBlock;
63116308
use chain::chaininterface::{FeeEstimator,ConfirmationTarget};
6312-
use chain::keysinterface::{InMemorySigner, Recipient, KeyMaterial, KeysInterface, BaseSign};
6309+
use chain::keysinterface::{InMemorySigner, Recipient, KeyMaterial, KeysInterface};
63136310
use chain::transaction::OutPoint;
63146311
use util::config::UserConfig;
63156312
use util::enforcing_trait_impls::EnforcingSigner;
63166313
use util::errors::APIError;
63176314
use util::test_utils;
63186315
use util::test_utils::OnGetShutdownScriptpubkey;
6319-
use util::logger::Logger;
6320-
use bitcoin::secp256k1::{Secp256k1, Message, Signature, All};
6316+
use bitcoin::secp256k1::{Secp256k1, Signature};
63216317
use bitcoin::secp256k1::ffi::Signature as FFISignature;
63226318
use bitcoin::secp256k1::key::{SecretKey,PublicKey};
63236319
use bitcoin::secp256k1::recovery::RecoverableSignature;
63246320
use bitcoin::hashes::sha256::Hash as Sha256;
63256321
use bitcoin::hashes::Hash;
6326-
use bitcoin::hash_types::{Txid, WPubkeyHash};
6322+
use bitcoin::hash_types::WPubkeyHash;
63276323
use core::num::NonZeroU8;
63286324
use bitcoin::bech32::u5;
6329-
use sync::Arc;
63306325
use prelude::*;
63316326

63326327
struct TestFeeEstimator {
@@ -6380,7 +6375,8 @@ mod tests {
63806375
fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result<RecoverableSignature, ()> { panic!(); }
63816376
}
63826377

6383-
fn public_from_secret_hex(secp_ctx: &Secp256k1<All>, hex: &str) -> PublicKey {
6378+
#[cfg(not(feature = "grind_signatures"))]
6379+
fn public_from_secret_hex(secp_ctx: &Secp256k1<bitcoin::secp256k1::All>, hex: &str) -> PublicKey {
63846380
PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&hex::decode(hex).unwrap()[..]).unwrap())
63856381
}
63866382

@@ -6669,6 +6665,19 @@ mod tests {
66696665
#[cfg(not(feature = "grind_signatures"))]
66706666
#[test]
66716667
fn outbound_commitment_test() {
6668+
use bitcoin::util::bip143;
6669+
use bitcoin::consensus::encode::serialize;
6670+
use bitcoin::blockdata::transaction::SigHashType;
6671+
use bitcoin::hashes::hex::FromHex;
6672+
use bitcoin::hash_types::Txid;
6673+
use bitcoin::secp256k1::Message;
6674+
use chain::keysinterface::BaseSign;
6675+
use ln::PaymentPreimage;
6676+
use ln::channel::{HTLCOutputInCommitment ,TxCreationKeys};
6677+
use ln::chan_utils::{ChannelPublicKeys, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters};
6678+
use util::logger::Logger;
6679+
use sync::Arc;
6680+
66726681
// Test vectors from BOLT 3 Appendices C and F (anchors):
66736682
let feeest = TestFeeEstimator{fee_est: 15000};
66746683
let logger : Arc<Logger> = Arc::new(test_utils::TestLogger::new());

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ impl core::hash::Hash for HTLCSource {
498498
}
499499
}
500500
}
501+
#[cfg(not(feature = "grind_signatures"))]
501502
#[cfg(test)]
502503
impl HTLCSource {
503504
pub fn dummy() -> Self {

0 commit comments

Comments
 (0)