//! channel being force-closed.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::genesis_block;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::script::{Builder, ScriptBuf};
-use bitcoin::blockdata::transaction::{Transaction, TxOut};
+use bitcoin::constants::genesis_block;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::opcodes;
+use bitcoin::script::{Builder, ScriptBuf};
+use bitcoin::transaction::{Transaction, TxOut};
use bitcoin::network::Network;
use bitcoin::transaction::Version;
//! This test has been very useful, though due to its complexity good starting inputs are critical.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::genesis_block;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::script::{Builder, ScriptBuf};
-use bitcoin::blockdata::transaction::{Transaction, TxOut};
+use bitcoin::constants::genesis_block;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::opcodes;
+use bitcoin::script::{Builder, ScriptBuf};
+use bitcoin::transaction::{Transaction, TxOut};
use bitcoin::consensus::encode::deserialize;
use bitcoin::network::Network;
use bitcoin::transaction::Version;
// Imports that need to be added manually
use bech32::u5;
-use bitcoin::blockdata::script::ScriptBuf;
+use bitcoin::script::ScriptBuf;
use bitcoin::secp256k1::ecdh::SharedSecret;
use bitcoin::secp256k1::ecdsa::RecoverableSignature;
use bitcoin::secp256k1::schnorr;
// licenses.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
-use bitcoin::blockdata::script::Builder;
-use bitcoin::blockdata::transaction::TxOut;
+use bitcoin::constants::ChainHash;
+use bitcoin::script::Builder;
+use bitcoin::transaction::TxOut;
use lightning::blinded_path::{BlindedHop, BlindedPath, IntroductionNode};
use lightning::chain::transaction::OutPoint;
#[cfg(all(feature = "std", test))]
mod tests {
use super::{BackgroundProcessor, GossipSync, FRESHNESS_TIMER};
- use bitcoin::blockdata::constants::{genesis_block, ChainHash};
- use bitcoin::blockdata::locktime::absolute::LockTime;
- use bitcoin::blockdata::transaction::{Transaction, TxOut};
+ use bitcoin::constants::{genesis_block, ChainHash};
+ use bitcoin::locktime::absolute::LockTime;
+ use bitcoin::transaction::{Transaction, TxOut};
use bitcoin::hashes::Hash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
use crate::utils::hex_to_work;
use crate::{BlockHeaderData, BlockSourceError};
-use bitcoin::blockdata::block::{Block, Header};
+use bitcoin::block::{Block, Header};
use bitcoin::consensus::encode;
use bitcoin::hash_types::{BlockHash, TxMerkleNode, Txid};
use bitcoin::hashes::hex::FromHex;
Ok(BlockHeaderData {
header: Header {
- version: bitcoin::blockdata::block::Version::from_consensus(
+ version: bitcoin::block::Version::from_consensus(
get_field!("version", as_i64).try_into().map_err(|_| ())?,
),
prev_blockhash: if let Some(hash_str) = response.get("previousblockhash") {
#[cfg(test)]
pub(crate) mod tests {
use super::*;
- use bitcoin::blockdata::constants::genesis_block;
+ use bitcoin::constants::genesis_block;
use bitcoin::hashes::Hash;
use bitcoin::network::Network;
use hex::DisplayHex;
use crate::{AsyncBlockSourceResult, BlockData, BlockSource, BlockSourceError};
-use bitcoin::blockdata::block::Block;
-use bitcoin::blockdata::constants::ChainHash;
-use bitcoin::blockdata::transaction::{OutPoint, TxOut};
+use bitcoin::block::Block;
+use bitcoin::constants::ChainHash;
+use bitcoin::transaction::{OutPoint, TxOut};
use bitcoin::hash_types::BlockHash;
use lightning::ln::peer_handler::APeerManager;
use crate::poll::{ChainPoller, Validate, ValidatedBlockHeader};
use crate::{BlockSource, BlockSourceResult, Cache, ChainNotifier};
-use bitcoin::blockdata::block::Header;
+use bitcoin::block::Header;
use bitcoin::hash_types::BlockHash;
use bitcoin::network::Network;
use crate::poll::{ChainTip, Poll, ValidatedBlockHeader};
-use bitcoin::blockdata::block::{Block, Header};
+use bitcoin::block::{Block, Header};
use bitcoin::hash_types::BlockHash;
use bitcoin::pow::Work;
UnboundedCache,
};
-use bitcoin::blockdata::block::{Block, Header, Version};
-use bitcoin::blockdata::constants::genesis_block;
-use bitcoin::blockdata::locktime::absolute::LockTime;
+use bitcoin::block::{Block, Header, Version};
+use bitcoin::constants::genesis_block;
+use bitcoin::locktime::absolute::LockTime;
use bitcoin::hash_types::{BlockHash, TxMerkleNode};
use bitcoin::network::Network;
use bitcoin::transaction;
} else {
None
};
- let genesis_timestamp = bitcoin::blockdata::constants::genesis_block(bitcoin::Network::Testnet).header.time as u64;
+ let genesis_timestamp = bitcoin::constants::genesis_block(bitcoin::Network::Testnet).header.time as u64;
let non_default_invoice_expiry_secs = 4200;
let invoice =
#[cfg(test)]
mod tests {
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
use bitcoin::Network;
use lightning::events::*;
//! from disk, which we do by calling [`RapidGossipSync::update_network_graph`]:
//!
//! ```
-//! use bitcoin::blockdata::constants::genesis_block;
+//! use bitcoin::constants::genesis_block;
//! use bitcoin::Network;
//! use lightning::routing::gossip::NetworkGraph;
//! use lightning_rapid_gossip_sync::RapidGossipSync;
use core::ops::Deref;
use core::sync::atomic::Ordering;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::PublicKey;
use lightning::io;
use lightning_transaction_sync::EsploraSyncClient;
use bdk_macros::maybe_await;
-use bitcoin::blockdata::block::Header;
-use bitcoin::blockdata::constants::genesis_block;
+use bitcoin::block::Header;
+use bitcoin::constants::genesis_block;
use bitcoin::network::Network;
use bitcoin::{Amount, BlockHash, Txid};
use bitcoind::bitcoincore_rpc::RpcApi;
use crate::prelude::*;
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::Transaction;
// TODO: Define typed abstraction over feerates to handle their conversions.
pub(crate) fn compute_feerate_sat_per_1000_weight(fee_sat: u64, weight: u64) -> u32 {
//! events. The remote server would make use of [`ChainMonitor`] for block processing and for
//! servicing [`ChannelMonitor`] updates from the client.
-use bitcoin::blockdata::block::Header;
+use bitcoin::block::Header;
use bitcoin::hash_types::{Txid, BlockHash};
use crate::chain;
//! ChannelMonitors to get out of the HSM and onto monitoring devices.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::block::Header;
-use bitcoin::blockdata::transaction::{OutPoint as BitcoinOutPoint, TxOut, Transaction};
-use bitcoin::blockdata::script::{Script, ScriptBuf};
+use bitcoin::block::Header;
+use bitcoin::transaction::{OutPoint as BitcoinOutPoint, TxOut, Transaction};
+use bitcoin::script::{Script, ScriptBuf};
use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256::Hash as Sha256;
#[cfg(test)]
pub fn deliberately_bogus_accepted_htlc_witness_program() -> Vec<u8> {
- use bitcoin::blockdata::opcodes;
+ use bitcoin::opcodes;
let mut ret = [opcodes::all::OP_NOP.to_u8(); 136];
ret[131] = opcodes::all::OP_DROP.to_u8();
ret[132] = opcodes::all::OP_DROP.to_u8();
#[cfg(test)]
mod tests {
use bitcoin::amount::Amount;
- use bitcoin::blockdata::locktime::absolute::LockTime;
- use bitcoin::blockdata::script::{ScriptBuf, Builder};
- use bitcoin::blockdata::opcodes;
- use bitcoin::blockdata::transaction::{Transaction, TxIn, TxOut, Version};
- use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
+ use bitcoin::locktime::absolute::LockTime;
+ use bitcoin::script::{ScriptBuf, Builder};
+ use bitcoin::opcodes;
+ use bitcoin::transaction::{Transaction, TxIn, TxOut, Version};
+ use bitcoin::transaction::OutPoint as BitcoinOutPoint;
use bitcoin::sighash;
use bitcoin::sighash::EcdsaSighashType;
use bitcoin::hashes::Hash;
//! Structs and traits which allow other parts of rust-lightning to interact with the blockchain.
-use bitcoin::blockdata::block::{Block, Header};
-use bitcoin::blockdata::constants::genesis_block;
-use bitcoin::blockdata::script::{Script, ScriptBuf};
+use bitcoin::block::{Block, Header};
+use bitcoin::constants::genesis_block;
+use bitcoin::script::{Script, ScriptBuf};
use bitcoin::hash_types::{BlockHash, Txid};
use bitcoin::network::Network;
use bitcoin::secp256k1::PublicKey;
//! building, tracking, bumping and notifications functions.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::transaction::Transaction;
-use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
-use bitcoin::blockdata::script::{Script, ScriptBuf};
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::transaction::Transaction;
+use bitcoin::transaction::OutPoint as BitcoinOutPoint;
+use bitcoin::script::{Script, ScriptBuf};
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hash_types::{Txid, BlockHash};
use bitcoin::{Sequence, Witness};
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::transaction::{TxOut,TxIn, Transaction};
-use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
-use bitcoin::blockdata::script::{Script, ScriptBuf};
+use bitcoin::constants::WITNESS_SCALE_FACTOR;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::transaction::{TxOut,TxIn, Transaction};
+use bitcoin::transaction::OutPoint as BitcoinOutPoint;
+use bitcoin::script::{Script, ScriptBuf};
use bitcoin::hash_types::Txid;
use bitcoin::secp256k1::{SecretKey,PublicKey};
use bitcoin::sighash::EcdsaSighashType;
use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint};
use bitcoin::amount::Amount;
- use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
- use bitcoin::blockdata::script::ScriptBuf;
- use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
+ use bitcoin::constants::WITNESS_SCALE_FACTOR;
+ use bitcoin::script::ScriptBuf;
+ use bitcoin::transaction::OutPoint as BitcoinOutPoint;
use bitcoin::hashes::hex::FromHex;
//! Types describing on-chain transactions.
use bitcoin::hash_types::Txid;
-use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::OutPoint as BitcoinOutPoint;
+use bitcoin::transaction::Transaction;
/// Transaction data where each item consists of a transaction reference paired with the index of
/// the transaction within a block.
/// extern crate bitcoin;
/// extern crate lightning;
///
-/// use bitcoin::blockdata::block::Block;
-/// use bitcoin::blockdata::constants::genesis_block;
+/// use bitcoin::block::Block;
+/// use bitcoin::constants::genesis_block;
/// use bitcoin::network::Network;
/// use lightning::chain::transaction::TransactionData;
///
/// A reference to a transaction output.
///
-/// Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
+/// Differs from bitcoin::transaction::OutPoint as the index is a u16 instead of u32
/// due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub struct OutPoint {
use crate::chain::transaction::OutPoint;
use crate::ln::types::ChannelId;
- use bitcoin::blockdata::transaction::Transaction;
+ use bitcoin::transaction::Transaction;
use bitcoin::consensus::encode;
use bitcoin::hashes::hex::FromHex;
use bitcoin::{OutPoint, Psbt, PubkeyHash, Sequence, ScriptBuf, Transaction, TxIn, TxOut, Witness, WPubkeyHash};
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
-use bitcoin::blockdata::locktime::absolute::LockTime;
+use bitcoin::constants::WITNESS_SCALE_FACTOR;
+use bitcoin::locktime::absolute::LockTime;
use bitcoin::consensus::Encodable;
use bitcoin::secp256k1;
use bitcoin::secp256k1::{PublicKey, Secp256k1};
use crate::util::string::UntrustedString;
use bitcoin::{Transaction, OutPoint};
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::script::ScriptBuf;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::script::ScriptBuf;
use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::secp256k1::PublicKey;
use std::collections::HashSet;
use bitcoin::{Transaction, TxOut, TxIn, Amount};
-use bitcoin::blockdata::locktime::absolute::LockTime;
+use bitcoin::locktime::absolute::LockTime;
use bitcoin::transaction::Version;
use crate::chain::channelmonitor::LATENCY_GRACE_PERIOD_BLOCKS;
use bitcoin::{PubkeyHash, WPubkeyHash};
use bitcoin::amount::Amount;
-use bitcoin::blockdata::script::{Script, ScriptBuf, Builder};
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::transaction::{TxIn,TxOut,OutPoint,Transaction};
+use bitcoin::script::{Script, ScriptBuf, Builder};
+use bitcoin::opcodes;
+use bitcoin::transaction::{TxIn,TxOut,OutPoint,Transaction};
use bitcoin::sighash;
use bitcoin::sighash::EcdsaSighashType;
use bitcoin::transaction::Version;
use crate::util::ser::{Readable, RequiredWrapper, Writeable, Writer};
use crate::util::transaction_utils;
-use bitcoin::blockdata::locktime::absolute::LockTime;
+use bitcoin::locktime::absolute::LockTime;
use bitcoin::ecdsa::Signature as BitcoinSignature;
use bitcoin::secp256k1::{SecretKey, PublicKey, Scalar};
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature, Message};
//! There are a bunch of these as their handling is relatively error-prone so they are split out
//! here. See also the chanmon_fail_consistency fuzz test.
-use bitcoin::blockdata::constants::genesis_block;
+use bitcoin::constants::genesis_block;
use bitcoin::hash_types::BlockHash;
use bitcoin::network::Network;
use crate::chain::channelmonitor::{ANTI_REORG_DELAY, ChannelMonitor};
// licenses.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
-use bitcoin::blockdata::script::{Script, ScriptBuf, Builder};
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::constants::ChainHash;
+use bitcoin::script::{Script, ScriptBuf, Builder};
+use bitcoin::transaction::Transaction;
use bitcoin::sighash;
use bitcoin::sighash::EcdsaSighashType;
use bitcoin::consensus::encode;
mod tests {
use std::cmp;
use bitcoin::amount::Amount;
- use bitcoin::blockdata::constants::ChainHash;
- use bitcoin::blockdata::script::{ScriptBuf, Builder};
- use bitcoin::blockdata::transaction::{Transaction, TxOut, Version};
- use bitcoin::blockdata::opcodes;
+ use bitcoin::constants::ChainHash;
+ use bitcoin::script::{ScriptBuf, Builder};
+ use bitcoin::transaction::{Transaction, TxOut, Version};
+ use bitcoin::opcodes;
use bitcoin::network::Network;
use crate::ln::onion_utils::INVALID_ONION_BLINDING;
use crate::ln::types::{PaymentHash, PaymentPreimage};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
use bitcoin::hashes::hex::FromHex;
- use bitcoin::blockdata::locktime::absolute::LockTime;
+ use bitcoin::locktime::absolute::LockTime;
use bitcoin::{WitnessProgram, WitnessVersion, WPubkeyHash};
use crate::prelude::*;
//! on-chain transactions (it only monitors the chain to watch for any force-closes that might
//! imply it needs to fail HTLCs/payments/channels it manages).
-use bitcoin::blockdata::block::Header;
-use bitcoin::blockdata::transaction::Transaction;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::block::Header;
+use bitcoin::transaction::Transaction;
+use bitcoin::constants::ChainHash;
use bitcoin::key::constants::SECRET_KEY_SIZE;
use bitcoin::network::Network;
use crate::util::config::{UserConfig, MaxDustHTLCExposure};
use bitcoin::amount::Amount;
- use bitcoin::blockdata::locktime::absolute::LockTime;
+ use bitcoin::locktime::absolute::LockTime;
use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::{Transaction, TxOut};
// Note that this is unrealistic as each payment send will require at least two fsync
// calls per node.
let network = bitcoin::Network::Testnet;
- let genesis_block = bitcoin::blockdata::constants::genesis_block(network);
+ let genesis_block = bitcoin::constants::genesis_block(network);
let tx_broadcaster = test_utils::TestBroadcaster::new(network);
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
use crate::util::ser::{ReadableArgs, Writeable};
use bitcoin::amount::Amount;
-use bitcoin::blockdata::block::{Block, Header, Version};
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::transaction::{Transaction, TxIn, TxOut};
+use bitcoin::block::{Block, Header, Version};
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::transaction::{Transaction, TxIn, TxOut};
use bitcoin::hash_types::{BlockHash, TxMerkleNode};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash as _;
}
}
-pub fn do_check_spends<F: Fn(&bitcoin::blockdata::transaction::OutPoint) -> Option<TxOut>>(tx: &Transaction, get_output: F) {
+pub fn do_check_spends<F: Fn(&bitcoin::transaction::OutPoint) -> Option<TxOut>>(tx: &Transaction, get_output: F) {
for outp in tx.output.iter() {
assert!(outp.value >= outp.script_pubkey.dust_value(), "Spending tx output didn't meet dust limit");
}
assert!(outp.value >= outp.script_pubkey.dust_value(), "Input tx output didn't meet dust limit");
}
)*
- let get_output = |out_point: &bitcoin::blockdata::transaction::OutPoint| {
+ let get_output = |out_point: &bitcoin::transaction::OutPoint| {
$(
if out_point.txid == $spends_txn.txid() {
return $spends_txn.output.get(out_point.vout as usize).cloned()
let mut chanmgrs = Vec::new();
for i in 0..node_count {
let network = Network::Testnet;
- let genesis_block = bitcoin::blockdata::constants::genesis_block(network);
+ let genesis_block = bitcoin::constants::genesis_block(network);
let params = ChainParameters {
network,
best_block: BestBlock::from_network(network),
use crate::util::config::{UserConfig, MaxDustHTLCExposure};
use bitcoin::hash_types::BlockHash;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::script::{Builder, ScriptBuf};
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::script::{Builder, ScriptBuf};
+use bitcoin::opcodes;
+use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::{Amount, Sequence, Transaction, TxIn, TxOut, Witness};
use bitcoin::OutPoint as BitcoinOutPoint;
use bitcoin::absolute::LockTime as AbsoluteLockTime;
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
+use bitcoin::constants::WITNESS_SCALE_FACTOR;
use bitcoin::consensus::Encodable;
use bitcoin::policy::MAX_STANDARD_TX_WEIGHT;
use bitcoin::transaction::Version;
use crate::util::ser::TransactionU16LenLimited;
use bitcoin::absolute::LockTime as AbsoluteLockTime;
use bitcoin::amount::Amount;
- use bitcoin::blockdata::opcodes;
- use bitcoin::blockdata::script::Builder;
+ use bitcoin::opcodes;
+ use bitcoin::script::Builder;
use bitcoin::hashes::Hash;
use bitcoin::key::UntweakedPublicKey;
use bitcoin::secp256k1::{Keypair, Secp256k1};
use crate::util::test_utils;
use bitcoin::{Amount, PublicKey, ScriptBuf, Transaction, TxIn, TxOut, Witness};
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::script::Builder;
-use bitcoin::blockdata::opcodes;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::script::Builder;
+use bitcoin::opcodes;
use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::{Secp256k1, SecretKey};
use bitcoin::sighash::{SighashCache, EcdsaSighashType};
//! 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 bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::PublicKey;
use bitcoin::secp256k1::ecdsa::Signature;
use bitcoin::{secp256k1, Witness};
-use bitcoin::blockdata::script::ScriptBuf;
+use bitcoin::script::ScriptBuf;
use bitcoin::hash_types::Txid;
use crate::blinded_path::payment::{BlindedPaymentTlvs, ForwardTlvs, ReceiveTlvs};
use bitcoin::hashes::hex::FromHex;
use bitcoin::address::Address;
use bitcoin::network::Network;
- use bitcoin::blockdata::constants::ChainHash;
- use bitcoin::blockdata::script::Builder;
- use bitcoin::blockdata::opcodes;
+ use bitcoin::constants::ChainHash;
+ use bitcoin::script::Builder;
+ use bitcoin::opcodes;
use bitcoin::hash_types::Txid;
use bitcoin::locktime::absolute::LockTime;
use bitcoin::transaction::Version;
use crate::util::config::{UserConfig, ChannelConfig, MaxDustHTLCExposure};
use crate::util::errors::APIError;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
//! call into the provided message handlers (probably a ChannelManager and P2PGossipSync) with
//! messages they should handle, and encoding/sending response messages.
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{self, Secp256k1, SecretKey, PublicKey};
use crate::blinded_path::message::OffersContext;
use crate::util::test_utils;
use bitcoin::Network;
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{PublicKey, SecretKey};
use crate::sync::{Arc, Mutex};
use crate::ln::functional_test_utils::*;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
#[test]
use crate::util::ser::Writeable;
use crate::util::string::UntrustedString;
-use bitcoin::blockdata::script::Builder;
-use bitcoin::blockdata::opcodes;
+use bitcoin::script::Builder;
+use bitcoin::opcodes;
use bitcoin::secp256k1::Secp256k1;
use crate::prelude::*;
//! Abstractions for scripts used in the Lightning Network.
use bitcoin::{WitnessProgram, WPubkeyHash, WScriptHash};
-use bitcoin::blockdata::opcodes::all::OP_PUSHBYTES_0 as SEGWIT_V0;
-use bitcoin::blockdata::script::{Script, ScriptBuf};
+use bitcoin::opcodes::all::OP_PUSHBYTES_0 as SEGWIT_V0;
+use bitcoin::script::{Script, ScriptBuf};
use bitcoin::hashes::Hash;
use bitcoin::secp256k1::PublicKey;
use super::ShutdownScript;
use bitcoin::{WitnessProgram, WitnessVersion};
- use bitcoin::blockdata::opcodes;
- use bitcoin::blockdata::script::{Builder, ScriptBuf};
+ use bitcoin::opcodes;
+ use bitcoin::script::{Builder, ScriptBuf};
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::{PublicKey, SecretKey};
use bitcoin::{Transaction, TxOut, WitnessProgram, WitnessVersion};
use bitcoin::amount::Amount;
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::script::Builder;
-use bitcoin::blockdata::opcodes;
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::script::Builder;
+use bitcoin::opcodes;
use bitcoin::network::Network;
use bitcoin::transaction::Version;
//! ```
use bitcoin::{WitnessProgram, Network, WitnessVersion};
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, self};
use bitcoin::secp256k1::schnorr::Signature;
use bitcoin::address::{Address, Payload};
use super::{Bolt12Invoice, DEFAULT_RELATIVE_EXPIRY, FallbackAddress, FullInvoiceTlvStreamRef, InvoiceTlvStreamRef, SIGNATURE_TAG, UnsignedBolt12Invoice};
use bitcoin::{WitnessProgram, WitnessVersion};
- use bitcoin::blockdata::constants::ChainHash;
- use bitcoin::blockdata::script::ScriptBuf;
+ use bitcoin::constants::ChainHash;
+ use bitcoin::script::ScriptBuf;
use bitcoin::hashes::Hash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, Message, Secp256k1, SecretKey, XOnlyPublicKey, self};
//! # }
//! ```
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, self};
use bitcoin::secp256k1::schnorr::Signature;
mod tests {
use super::{InvoiceRequest, InvoiceRequestFields, InvoiceRequestTlvStreamRef, PAYER_NOTE_LIMIT, SIGNATURE_TAG, UnsignedInvoiceRequest};
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, Secp256k1, SecretKey, self};
use core::num::NonZeroU64;
//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
//! [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, self};
use core::hash::{Hash, Hasher};
/// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
/// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
/// for the selected chain.
- pub fn chains(&$self) -> Vec<bitcoin::blockdata::constants::ChainHash> {
+ pub fn chains(&$self) -> Vec<bitcoin::constants::ChainHash> {
$contents.chains()
}
super::OfferWithExplicitMetadataBuilder as OfferBuilder,
};
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::Secp256k1;
use core::num::NonZeroU64;
//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
//! [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{PublicKey, Secp256k1, self};
use core::hash::{Hash, Hasher};
super::RefundMaybeWithDerivedMetadataBuilder as RefundBuilder,
};
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, Secp256k1, SecretKey};
use crate::util::ser::{Iterable, SeekReadable, WithoutLength, Writeable, Writer};
use crate::util::string::PrintableString;
use bitcoin::address::Address;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::schnorr::Signature;
use bitcoin::secp256k1::{self, Keypair, PublicKey, Secp256k1};
use core::time::Duration;
use crate::offers::test_utils::*;
use crate::sign::KeyMaterial;
use crate::util::ser::{BigSize, Iterable, Writeable};
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{self, Secp256k1};
use bitcoin::Network;
use core::time::Duration;
//! The [`NetworkGraph`] stores the network gossip and [`P2PGossipSync`] fetches it from peers
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::secp256k1;
use bitcoin::secp256k1::constants::PUBLIC_KEY_SIZE;
use bitcoin::hashes::hex::FromHex;
use bitcoin::network::Network;
use bitcoin::amount::Amount;
- use bitcoin::blockdata::constants::ChainHash;
- use bitcoin::blockdata::script::ScriptBuf;
- use bitcoin::blockdata::transaction::TxOut;
+ use bitcoin::constants::ChainHash;
+ use bitcoin::script::ScriptBuf;
+ use bitcoin::transaction::TxOut;
use bitcoin::secp256k1::{PublicKey, SecretKey};
use bitcoin::secp256k1::{All, Secp256k1};
use bitcoin::amount::Amount;
use bitcoin::hashes::Hash;
use bitcoin::network::Network;
- use bitcoin::blockdata::constants::ChainHash;
- use bitcoin::blockdata::script::Builder;
- use bitcoin::blockdata::opcodes;
- use bitcoin::blockdata::transaction::TxOut;
+ use bitcoin::constants::ChainHash;
+ use bitcoin::script::Builder;
+ use bitcoin::opcodes;
+ use bitcoin::transaction::TxOut;
use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::{PublicKey,SecretKey};
use bitcoin::secp256k1::Secp256k1;
use crate::util::ser::{ReadableArgs, Writeable};
use crate::util::test_utils::{self, TestLogger};
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::network::Network;
use crate::util::test_utils;
use crate::util::ser::Writeable;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::Hash;
use bitcoin::hashes::hex::FromHex;
use bitcoin::TxOut;
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
+use bitcoin::constants::ChainHash;
use hex::DisplayHex;
//! Defines ECDSA-specific signer types.
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::Transaction;
use bitcoin::secp256k1;
use bitcoin::secp256k1::ecdsa::Signature;
use bitcoin::amount::Amount;
use bitcoin::bip32::{ChildNumber, Xpriv, Xpub};
-use bitcoin::blockdata::locktime::absolute::LockTime;
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::script::{Builder, Script, ScriptBuf};
-use bitcoin::blockdata::transaction::{Transaction, TxIn, TxOut};
+use bitcoin::locktime::absolute::LockTime;
+use bitcoin::opcodes;
+use bitcoin::script::{Builder, Script, ScriptBuf};
+use bitcoin::transaction::{Transaction, TxIn, TxOut};
use bitcoin::ecdsa::Signature as EcdsaSignature;
use bitcoin::network::Network;
use bitcoin::sighash;
#[cfg(ldk_bench)]
pub mod benches {
use crate::sign::{EntropySource, KeysManager};
- use bitcoin::blockdata::constants::genesis_block;
+ use bitcoin::constants::genesis_block;
use bitcoin::Network;
use std::sync::mpsc::TryRecvError;
use std::sync::{mpsc, Arc};
//! Defines a Taproot-specific signer type.
use alloc::vec::Vec;
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::Transaction;
use bitcoin::secp256k1;
use bitcoin::secp256k1::{schnorr::Signature, PublicKey, Secp256k1, SecretKey};
use crate::ln::types::ChannelId;
use crate::sign::SpendableOutputDescriptor;
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::Transaction;
use crate::routing::router::Route;
use crate::ln::chan_utils::HTLCClaim;
/// 3) payments intended to be intercepted will route using a fake scid (this is typically used so
/// the forwarding node can open a JIT channel to the next hop)
pub(crate) mod fake_scid {
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::Network;
use crate::sign::EntropySource;
use crate::crypto::chacha20::ChaCha20;
#[cfg(test)]
mod tests {
- use bitcoin::blockdata::constants::ChainHash;
+ use bitcoin::constants::ChainHash;
use bitcoin::network::Network;
use crate::util::scid_utils::fake_scid::{is_valid_intercept, is_valid_phantom, MAINNET_SEGWIT_ACTIVATION_HEIGHT, MAX_TX_INDEX, MAX_NAMESPACES, Namespace, NAMESPACE_ID_BITMASK, segwit_activation_height, TEST_SEGWIT_ACTIVATION_HEIGHT};
use crate::util::scid_utils;
use bitcoin::secp256k1::ecdsa;
use bitcoin::secp256k1::schnorr;
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
-use bitcoin::blockdata::script::{self, ScriptBuf};
-use bitcoin::blockdata::transaction::{OutPoint, Transaction, TxOut};
+use bitcoin::constants::ChainHash;
+use bitcoin::script::{self, ScriptBuf};
+use bitcoin::transaction::{OutPoint, Transaction, TxOut};
use bitcoin::{consensus, Witness};
use bitcoin::consensus::Encodable;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use crate::util::ser::{Readable, ReadableArgs, Writeable};
use crate::{impl_writeable_tlv_based, log_debug, log_error};
-use bitcoin::blockdata::block::Header;
-use bitcoin::blockdata::locktime::absolute::LockTime;
+use bitcoin::block::Header;
+use bitcoin::locktime::absolute::LockTime;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::{BlockHash, Transaction, Txid};
use crate::sync::{Mutex, Arc};
#[cfg(test)] use crate::sync::MutexGuard;
-use bitcoin::blockdata::transaction::Transaction;
+use bitcoin::transaction::Transaction;
use bitcoin::hashes::Hash;
use bitcoin::sighash;
use bitcoin::sighash::EcdsaSighashType;
use crate::util::persist::KVStore;
use bitcoin::amount::Amount;
-use bitcoin::blockdata::constants::ChainHash;
-use bitcoin::blockdata::constants::genesis_block;
-use bitcoin::blockdata::transaction::{Transaction, TxOut};
-use bitcoin::blockdata::script::{Builder, Script, ScriptBuf};
-use bitcoin::blockdata::opcodes;
-use bitcoin::blockdata::block::Block;
+use bitcoin::constants::ChainHash;
+use bitcoin::constants::genesis_block;
+use bitcoin::transaction::{Transaction, TxOut};
+use bitcoin::script::{Builder, Script, ScriptBuf};
+use bitcoin::opcodes;
+use bitcoin::block::Block;
use bitcoin::network::Network;
use bitcoin::hash_types::{BlockHash, Txid};
use bitcoin::hashes::Hash;
// licenses.
use bitcoin::amount::Amount;
-use bitcoin::blockdata::transaction::{Transaction, TxOut};
-use bitcoin::blockdata::script::ScriptBuf;
+use bitcoin::transaction::{Transaction, TxOut};
+use bitcoin::script::ScriptBuf;
use bitcoin::consensus::Encodable;
use bitcoin::consensus::encode::VarInt;
use super::*;
use bitcoin::amount::Amount;
- use bitcoin::blockdata::locktime::absolute::LockTime;
- use bitcoin::blockdata::transaction::{TxIn, OutPoint, Version};
- use bitcoin::blockdata::script::Builder;
+ use bitcoin::locktime::absolute::LockTime;
+ use bitcoin::transaction::{TxIn, OutPoint, Version};
+ use bitcoin::script::Builder;
use bitcoin::hash_types::Txid;
use bitcoin::hashes::Hash;
use bitcoin::hashes::hex::FromHex;