lightning-invoice = { path = "../lightning-invoice" }
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync" }
bech32 = "0.9.1"
-bitcoin = { version = "0.31.2", features = ["secp-lowmemory"] }
+bitcoin = { version = "0.32.2", features = ["secp-lowmemory"] }
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
afl = { version = "0.12", optional = true }
[features]
futures = [ ]
std = ["bitcoin/std", "lightning/std", "lightning-rapid-gossip-sync/std"]
-no-std = ["bitcoin/no-std", "lightning/no-std", "lightning-rapid-gossip-sync/no-std"]
+no-std = ["lightning/no-std", "lightning-rapid-gossip-sync/no-std"]
default = ["std"]
[dependencies]
-bitcoin = { version = "0.31.2", default-features = false }
+bitcoin = { version = "0.32.2", default-features = false }
lightning = { version = "0.0.123-beta", path = "../lightning", default-features = false }
lightning-rapid-gossip-sync = { version = "0.0.123-beta", path = "../lightning-rapid-gossip-sync", default-features = false }
rpc-client = [ "serde_json", "chunked_transfer" ]
[dependencies]
-bitcoin = "0.31.2"
+bitcoin = "0.32.2"
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
lightning = { version = "0.0.123-beta", path = "../lightning" }
tokio = { version = "1.35", features = [ "io-util", "net", "time", "rt" ], optional = true }
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
-bitcoin = "0.31.2"
+bitcoin = "0.32.2"
lightning = { version = "0.0.123-beta", path = "../lightning" }
[lints]
lightning = { version = "0.0.123-beta", path = "../lightning", default-features = false }
secp256k1 = { version = "0.28.0", default-features = false, features = ["recovery", "alloc"] }
serde = { version = "1.0.118", optional = true }
-bitcoin = { version = "0.31.2", default-features = false }
+bitcoin = { version = "0.32.2", default-features = false }
[dev-dependencies]
lightning = { version = "0.0.123-beta", path = "../lightning", default-features = false, features = ["_test_utils"] }
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
-bitcoin = "0.31.2"
+bitcoin = "0.32.2"
lightning = { version = "0.0.123-beta", path = "../lightning" }
tokio = { version = "1.35", features = [ "rt", "sync", "net", "time" ] }
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
-bitcoin = "0.31.2"
+bitcoin = "0.32.2"
lightning = { version = "0.0.123-beta", path = "../lightning" }
[target.'cfg(windows)'.dependencies]
[dev-dependencies]
lightning = { version = "0.0.123-beta", path = "../lightning", features = ["_test_utils"] }
-bitcoin = { version = "0.31.2", default-features = false }
+bitcoin = { version = "0.32.2", default-features = false }
[lints]
workspace = true
[dependencies]
lightning = { version = "0.0.123-beta", path = "../lightning", default-features = false }
-bitcoin = { version = "0.31.2", default-features = false }
+bitcoin = { version = "0.32.2", default-features = false }
[target.'cfg(ldk_bench)'.dependencies]
criterion = { version = "0.4", optional = true, default-features = false }
[dependencies]
lightning = { version = "0.0.123-beta", path = "../lightning", default-features = false, features = ["std"] }
-bitcoin = { version = "0.31.2", default-features = false }
+bitcoin = { version = "0.32.2", default-features = false }
bdk-macros = "0.6"
futures = { version = "0.3", optional = true }
esplora-client = { version = "0.7", default-features = false, optional = true }
# Override signing to not include randomness when generating signatures for test vectors.
_test_vectors = []
-no-std = ["hashbrown", "possiblyrandom", "bitcoin/no-std", "core2/alloc", "libm"]
+no-std = ["hashbrown", "possiblyrandom", "core2/alloc", "libm"]
std = ["bitcoin/std", "bech32/std"]
# Generates low-r bitcoin signatures, which saves 1 byte in 50% of the cases
[dependencies]
bech32 = { version = "0.9.1", default-features = false }
-bitcoin = { version = "0.31.2", default-features = false, features = ["secp-recovery"] }
+bitcoin = { version = "0.32.2", default-features = false, features = ["secp-recovery"] }
hashbrown = { version = "0.13", optional = true, default-features = false }
possiblyrandom = { version = "0.2", optional = true, default-features = false }
regex = "1.5.6"
[dev-dependencies.bitcoin]
-version = "0.31.2"
+version = "0.32.2"
default-features = false
features = ["bitcoinconsensus", "secp-recovery"]
criterion = { version = "0.4", optional = true, default-features = false }
[target.'cfg(taproot)'.dependencies]
-musig2 = { git = "https://github.com/arik-so/rust-musig2", rev = "739533fc" }
+musig2 = { git = "https://github.com/arik-so/rust-musig2", rev = "6f95a05718cbb44d8fe3fa6021aea8117aa38d50" }
[lints]
workspace = true
use bitcoin::ecdsa::Signature as BitcoinSignature;
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
use bitcoin::secp256k1::{SecretKey, PublicKey};
-use bitcoin::secp256k1;
+use bitcoin::{CompressedPublicKey, secp256k1};
use crate::ln::channel::INITIAL_COMMITMENT_NUMBER;
use crate::ln::types::{PaymentHash, PaymentPreimage, ChannelId};
assert_eq!(&bitcoin::Address::p2wsh(&ScriptBuf::from(input.witness.last().unwrap().to_vec()), bitcoin::Network::Bitcoin).script_pubkey(), _script_pubkey);
} else if _script_pubkey.is_p2wpkh() {
- assert_eq!(&bitcoin::Address::p2wpkh(&bitcoin::PublicKey::from_slice(&input.witness.last().unwrap()).unwrap(), bitcoin::Network::Bitcoin).unwrap().script_pubkey(), _script_pubkey);
+ assert_eq!(&bitcoin::Address::p2wpkh(&CompressedPublicKey(bitcoin::PublicKey::from_slice(&input.witness.last().unwrap()).unwrap().inner), bitcoin::Network::Bitcoin).script_pubkey(), _script_pubkey);
} else { panic!(); }
}
return true;
use bitcoin::hashes::Hash;
use bitcoin::hashes::hex::FromHex;
use crate::ln::types::PaymentHash;
- use bitcoin::address::Payload;
use bitcoin::PublicKey as BitcoinPublicKey;
use crate::ln::features::ChannelTypeFeatures;
// Generate broadcaster and counterparty outputs
let tx = builder.build(1000, 2000);
assert_eq!(tx.built.transaction.output.len(), 2);
- assert_eq!(tx.built.transaction.output[1].script_pubkey, Payload::p2wpkh(&BitcoinPublicKey::new(builder.counterparty_pubkeys.payment_point)).unwrap().script_pubkey());
+ assert_eq!(tx.built.transaction.output[1].script_pubkey, BitcoinPublicKey::new(builder.counterparty_pubkeys.payment_point).p2wpkh_script_code().unwrap());
// Generate broadcaster and counterparty outputs as well as two anchors
builder.channel_parameters.channel_type_features = ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies();
//!
//! ```
-use bitcoin::{WitnessProgram, Network, WitnessVersion};
+use bitcoin::{Network, WitnessVersion};
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, self};
use bitcoin::secp256k1::schnorr::Signature;
-use bitcoin::address::{Address, Payload};
+use bitcoin::address::Address;
+use bitcoin::blockdata::script::witness_program::WitnessProgram;
use core::time::Duration;
use core::hash::{Hash, Hasher};
use crate::io;
Err(_) => return None,
};
- let program = address.program.clone();
- let witness_program = match WitnessProgram::new(version, program) {
+ let witness_program = match WitnessProgram::new(version, &address.program) {
Ok(witness_program) => witness_program,
Err(_) => return None,
};
- Some(Address::new(network, Payload::WitnessProgram(witness_program)))
+ Some(Address::from_witness_program(witness_program, network.into()))
};
fallbacks.iter().filter_map(to_valid_address).collect()
mod tests {
use super::{Bolt12Invoice, DEFAULT_RELATIVE_EXPIRY, FallbackAddress, FullInvoiceTlvStreamRef, InvoiceTlvStreamRef, SIGNATURE_TAG, UnsignedBolt12Invoice};
- use bitcoin::{WitnessProgram, WitnessVersion};
+ use bitcoin::{CompressedPublicKey, WitnessProgram, WitnessVersion};
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::blockdata::script::ScriptBuf;
use bitcoin::hashes::Hash;
use bitcoin::network::Network;
use bitcoin::secp256k1::{Keypair, Message, Secp256k1, SecretKey, XOnlyPublicKey, self};
- use bitcoin::address::{Address, Payload};
+ use bitcoin::address::Address;
use bitcoin::key::TweakedPublicKey;
use core::time::Duration;
match Bolt12Invoice::try_from(buffer) {
Ok(invoice) => {
- let v1_witness_program = WitnessProgram::new(WitnessVersion::V1, vec![0u8; 33]).unwrap();
- let v2_witness_program = WitnessProgram::new(WitnessVersion::V2, vec![0u8; 40]).unwrap();
+ let v1_witness_program = WitnessProgram::new(WitnessVersion::V1, &vec![0u8; 33]).unwrap();
+ let v2_witness_program = WitnessProgram::new(WitnessVersion::V2, &vec![0u8; 40]).unwrap();
assert_eq!(
invoice.fallbacks(),
vec![
Address::p2wsh(&script, Network::Bitcoin),
- Address::p2wpkh(&pubkey, Network::Bitcoin).unwrap(),
+ Address::p2wpkh(&CompressedPublicKey(pubkey.inner), Network::Bitcoin).unwrap(),
Address::p2tr_tweaked(tweaked_pubkey, Network::Bitcoin),
- Address::new(Network::Bitcoin, Payload::WitnessProgram(v1_witness_program)),
- Address::new(Network::Bitcoin, Payload::WitnessProgram(v2_witness_program)),
+ Address::from_witness_program(v1_witness_program, Network::Bitcoin.into()),
+ Address::from_witness_program(v2_witness_program, Network::Bitcoin.into()),
],
);
},
}
}
}
+
+impl Into<io::ErrorKind> for bitcoin::io::ErrorKind {
+ fn into(self) -> io::ErrorKind {
+ todo!()
+ }
+}
+
+impl Writeable for Witness {
+ fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
+ match self.consensus_encode(&mut WriterWriteAdaptor(writer)) {
+ Ok(_) => Ok(()),
+ Err(e) => Err(e.into()),
+ }
+ }
+}
+impl Readable for Witness {
+ fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
+ match consensus::encode::Decodable::consensus_decode(r) {
+ Ok(t) => Ok(t),
+ Err(consensus::encode::Error::Io(ref e)) if e.kind() == bitcoin::io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
+ Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
+ Err(_) => Err(DecodeError::InvalidValue),
+ }
+ }
+}
+
impl_consensus_ser!(Transaction);
impl_consensus_ser!(TxOut);
-impl_consensus_ser!(Witness);
+// impl_consensus_ser!(Witness);
impl<T: Readable> Readable for Mutex<T> {
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {