use utils::test_logger;
-use secp256k1::key::{PublicKey,SecretKey};
-use secp256k1::Secp256k1;
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::Secp256k1;
use std::mem;
use std::cmp::Ordering;
use utils::test_logger;
-use secp256k1::key::{PublicKey,SecretKey};
-use secp256k1::Secp256k1;
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::Secp256k1;
use std::cell::RefCell;
use std::collections::{HashMap, hash_map};
use lightning::ln::peer_channel_encryptor::PeerChannelEncryptor;
-use secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
use utils::test_logger;
use lightning::util::logger::Logger;
use lightning::util::ser::Readable;
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::key::PublicKey;
use utils::test_logger;
[dependencies]
bitcoin = "0.21"
lightning = { version = "0.0.11", path = "../lightning" }
-secp256k1 = "0.15"
tokio = { version = ">=0.2.12", features = [ "io-util", "macros", "rt-core", "sync", "tcp", "time" ] }
[dev-dependencies]
//! ```
//! use tokio::sync::mpsc;
//! use tokio::net::TcpStream;
-//! use secp256k1::key::PublicKey;
+//! use bitcoin::secp256k1::key::PublicKey;
//! use lightning::util::events::EventsProvider;
//! use std::net::SocketAddr;
//! use std::sync::Arc;
//! }
//! ```
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::key::PublicKey;
use tokio::net::TcpStream;
use tokio::{io, time};
use lightning::ln::msgs::*;
use lightning::ln::peer_handler::{MessageHandler, PeerManager};
use lightning::util::events::*;
- use secp256k1::{Secp256k1, SecretKey, PublicKey};
+ use bitcoin::secp256k1::{Secp256k1, SecretKey, PublicKey};
use tokio::sync::mpsc;
[features]
# Supports tracking channels with a non-bitcoin chain hashes. Currently enables all kinds of fun DoS attacks.
non_bitcoin_chain_hash_routing = []
-fuzztarget = ["secp256k1/fuzztarget", "bitcoin/fuzztarget"]
+fuzztarget = ["bitcoin/fuzztarget"]
# Unlog messages superior at targeted level.
max_level_off = []
max_level_error = []
[dependencies]
bitcoin = "0.21"
-secp256k1 = "0.15"
[dev-dependencies.bitcoin]
version = "0.21"
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::hash160::Hash as Hash160;
-use secp256k1::key::{SecretKey, PublicKey};
-use secp256k1::{Secp256k1, Signature, Signing};
-use secp256k1;
+use bitcoin::secp256k1::key::{SecretKey, PublicKey};
+use bitcoin::secp256k1::{Secp256k1, Signature, Signing};
+use bitcoin::secp256k1;
use util::byte_utils;
use util::logger::Logger;
#![allow(ellipsis_inclusive_range_patterns)]
extern crate bitcoin;
-extern crate secp256k1;
#[cfg(test)] extern crate rand;
#[cfg(test)] extern crate hex;
use util::ser::{Readable, Writeable, Writer, WriterWriteAdaptor};
use util::byte_utils;
-use secp256k1::key::{SecretKey, PublicKey};
-use secp256k1::{Secp256k1, Signature};
-use secp256k1;
+use bitcoin::secp256k1::key::{SecretKey, PublicKey};
+use bitcoin::secp256k1::{Secp256k1, Signature};
+use bitcoin::secp256k1;
use std::{cmp, mem};
use bitcoin::hashes::hash160::Hash as Hash160;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
-use secp256k1::key::{PublicKey,SecretKey};
-use secp256k1::{Secp256k1,Signature};
-use secp256k1;
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::{Secp256k1,Signature};
+use bitcoin::secp256k1;
use ln::features::{ChannelFeatures, InitFeatures};
use ln::msgs;
use util::enforcing_trait_impls::EnforcingChannelKeys;
use util::test_utils;
use util::logger::Logger;
- use secp256k1::{Secp256k1, Message, Signature, All};
- use secp256k1::key::{SecretKey,PublicKey};
+ use bitcoin::secp256k1::{Secp256k1, Message, Signature, All};
+ use bitcoin::secp256k1::key::{SecretKey,PublicKey};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::hash160::Hash as Hash160;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::cmp::fixed_time_eq;
-use secp256k1::key::{SecretKey,PublicKey};
-use secp256k1::Secp256k1;
-use secp256k1::ecdh::SharedSecret;
-use secp256k1;
+use bitcoin::secp256k1::key::{SecretKey,PublicKey};
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::secp256k1::ecdh::SharedSecret;
+use bitcoin::secp256k1;
use chain::chaininterface::{BroadcasterInterface,ChainListener,FeeEstimator};
use chain::transaction::OutPoint;
use bitcoin::hashes::hash160::Hash as Hash160;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
-use secp256k1::{Secp256k1,Signature};
-use secp256k1::key::{SecretKey,PublicKey};
-use secp256k1;
+use bitcoin::secp256k1::{Secp256k1,Signature};
+use bitcoin::secp256k1::key::{SecretKey,PublicKey};
+use bitcoin::secp256k1;
use ln::msgs::DecodeError;
use ln::chan_utils;
use ln::chan_utils;
use ln::chan_utils::{HTLCOutputInCommitment, LocalCommitmentTransaction};
use util::test_utils::TestLogger;
- use secp256k1::key::{SecretKey,PublicKey};
- use secp256k1::Secp256k1;
+ use bitcoin::secp256k1::key::{SecretKey,PublicKey};
+ use bitcoin::secp256k1::Secp256k1;
use rand::{thread_rng,Rng};
use std::sync::Arc;
use chain::keysinterface::InMemoryChannelKeys;
use bitcoin::hashes::sha256d::Hash as Sha256d;
use bitcoin::hashes::Hash;
-use secp256k1::Secp256k1;
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::secp256k1::key::PublicKey;
use rand::{thread_rng,Rng};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
-use secp256k1::{Secp256k1, Message};
-use secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::{Secp256k1, Message};
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
use std::collections::{BTreeSet, HashMap, HashSet};
use std::default::Default;
impl msgs::ChannelUpdate {
fn dummy() -> msgs::ChannelUpdate {
- use secp256k1::ffi::Signature as FFISignature;
- use secp256k1::Signature;
+ use bitcoin::secp256k1::ffi::Signature as FFISignature;
+ use bitcoin::secp256k1::Signature;
msgs::ChannelUpdate {
signature: Signature::from(FFISignature::new()),
contents: msgs::UnsignedChannelUpdate {
fn test_onion_failure() {
use ln::msgs::ChannelUpdate;
use ln::channelmanager::CLTV_FAR_FAR_AWAY;
- use secp256k1;
+ use bitcoin::secp256k1;
const BADONION: u16 = 0x8000;
const PERM: u16 = 0x4000;
//! raw socket events into your non-internet-facing system and then send routing events back to
//! track the network on the less-secure system.
-use secp256k1::key::PublicKey;
-use secp256k1::Signature;
-use secp256k1;
+use bitcoin::secp256k1::key::PublicKey;
+use bitcoin::secp256k1::Signature;
+use bitcoin::secp256k1;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::blockdata::script::Script;
use bitcoin::blockdata::script::Builder;
use bitcoin::blockdata::opcodes;
- use secp256k1::key::{PublicKey,SecretKey};
- use secp256k1::{Secp256k1, Message};
+ use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+ use bitcoin::secp256k1::{Secp256k1, Message};
use std::io::Cursor;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
-use secp256k1::{Secp256k1, Signature};
-use secp256k1;
+use bitcoin::secp256k1::{Secp256k1, Signature};
+use bitcoin::secp256k1;
use ln::msgs::DecodeError;
use ln::channelmonitor::{ANTI_REORG_DELAY, CLTV_SHARED_CLAIM_BUFFER, InputMaterial, ClaimRequest};
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
-use secp256k1::key::{SecretKey,PublicKey};
-use secp256k1::Secp256k1;
-use secp256k1::ecdh::SharedSecret;
-use secp256k1;
+use bitcoin::secp256k1::key::{SecretKey,PublicKey};
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::secp256k1::ecdh::SharedSecret;
+use bitcoin::secp256k1;
use std::io::Cursor;
use std::sync::Arc;
use hex;
- use secp256k1::Secp256k1;
- use secp256k1::key::{PublicKey,SecretKey};
+ use bitcoin::secp256k1::Secp256k1;
+ use bitcoin::secp256k1::key::{PublicKey,SecretKey};
use super::OnionKeys;
use bitcoin::hashes::{Hash, HashEngine, Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
-use secp256k1::Secp256k1;
-use secp256k1::key::{PublicKey,SecretKey};
-use secp256k1::ecdh::SharedSecret;
-use secp256k1;
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+use bitcoin::secp256k1::ecdh::SharedSecret;
+use bitcoin::secp256k1;
use util::chacha20poly1305rfc::ChaCha20Poly1305RFC;
use util::byte_utils;
#[cfg(test)]
mod tests {
- use secp256k1::key::{PublicKey,SecretKey};
+ use bitcoin::secp256k1::key::{PublicKey,SecretKey};
use hex;
//! call into the provided message handlers (probably a ChannelManager and Router) with messages
//! they should handle, and encoding/sending response messages.
-use secp256k1::key::{SecretKey,PublicKey};
+use bitcoin::secp256k1::key::{SecretKey,PublicKey};
use ln::features::InitFeatures;
use ln::msgs;
#[cfg(test)]
mod tests {
- use secp256k1::Signature;
+ use bitcoin::secp256k1::Signature;
use bitcoin::BitcoinHash;
use bitcoin::network::constants::Network;
use bitcoin::blockdata::constants::genesis_block;
use util::test_utils;
use util::logger::Logger;
- use secp256k1::Secp256k1;
- use secp256k1::key::{SecretKey, PublicKey};
+ use bitcoin::secp256k1::Secp256k1;
+ use bitcoin::secp256k1::key::{SecretKey, PublicKey};
use rand::{thread_rng, Rng};
}
fn get_dummy_channel_announcement(short_chan_id: u64) -> msgs::ChannelAnnouncement {
- use secp256k1::ffi::Signature as FFISignature;
+ use bitcoin::secp256k1::ffi::Signature as FFISignature;
let secp_ctx = Secp256k1::new();
let network = Network::Testnet;
let node_1_privkey = SecretKey::from_slice(&[42; 32]).unwrap();
}
fn get_dummy_channel_update(short_chan_id: u64) -> msgs::ChannelUpdate {
- use secp256k1::ffi::Signature as FFISignature;
+ use bitcoin::secp256k1::ffi::Signature as FFISignature;
let network = Network::Testnet;
msgs::ChannelUpdate {
signature: Signature::from(FFISignature::new()),
//! You probably want to create a Router and use that as your RoutingMessageHandler and then
//! interrogate it to get routes for your own payments.
-use secp256k1::key::PublicKey;
-use secp256k1::Secp256k1;
-use secp256k1;
+use bitcoin::secp256k1::key::PublicKey;
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::secp256k1;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::Hash;
use hex;
- use secp256k1::key::{PublicKey,SecretKey};
- use secp256k1::All;
- use secp256k1::Secp256k1;
+ use bitcoin::secp256k1::key::{PublicKey,SecretKey};
+ use bitcoin::secp256k1::All;
+ use bitcoin::secp256k1::Secp256k1;
use std::sync::Arc;
use std::collections::btree_map::Entry as BtreeEntry;
use bitcoin::blockdata::transaction::Transaction;
use bitcoin::util::bip143;
-use secp256k1;
-use secp256k1::key::{SecretKey, PublicKey};
-use secp256k1::{Secp256k1, Signature};
+use bitcoin::secp256k1;
+use bitcoin::secp256k1::key::{SecretKey, PublicKey};
+use bitcoin::secp256k1::{Secp256k1, Signature};
use util::ser::{Writeable, Writer, Readable};
use std::io::Error;
use ln::msgs::DecodeError;
use bitcoin::blockdata::script::Script;
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::key::PublicKey;
use std::time::Duration;
{
#[cfg(not(feature = "fuzztarget"))]
{
- ::secp256k1::Message::from_slice($slice).unwrap()
+ ::bitcoin::secp256k1::Message::from_slice($slice).unwrap()
}
#[cfg(feature = "fuzztarget")]
{
- match ::secp256k1::Message::from_slice($slice) {
+ match ::bitcoin::secp256k1::Message::from_slice($slice) {
Ok(msg) => msg,
- Err(_) => ::secp256k1::Message::from_slice(&[1; 32]).unwrap()
+ Err(_) => ::bitcoin::secp256k1::Message::from_slice(&[1; 32]).unwrap()
}
}
}
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::blockdata::transaction::Transaction;
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::key::PublicKey;
use ln::router::Route;
use ln::chan_utils::HTLCType;
use std::sync::Mutex;
use std::cmp;
-use secp256k1::Signature;
-use secp256k1::key::{PublicKey, SecretKey};
+use bitcoin::secp256k1::Signature;
+use bitcoin::secp256k1::key::{PublicKey, SecretKey};
use bitcoin::blockdata::script::Script;
use bitcoin::blockdata::transaction::{OutPoint, Transaction, TxOut};
use bitcoin::consensus;
use std::io::{Cursor, Read};
use ln::msgs::DecodeError;
use util::ser::{Readable, Writeable, HighZeroBytesDroppedVarInt, VecWriter};
- use secp256k1::PublicKey;
+ use bitcoin::secp256k1::PublicKey;
// The BOLT TLV test cases don't include any tests which use our "required-value" logic since
// the encoding layer in the BOLTs has no such concept, though it makes our macros easier to
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::network::constants::Network;
-use secp256k1::{SecretKey, PublicKey};
+use bitcoin::secp256k1::{SecretKey, PublicKey};
use std::time::{SystemTime, UNIX_EPOCH};
use std::sync::{Arc,Mutex};