bitcoin_hashes = { version = "0.11", default-features = false }
hashbrown = { version = "0.8", optional = true }
serde = { version = "1.0.118", optional = true }
+ bitcoin = { version = "0.29.0", default-features = false }
[dev-dependencies]
-lightning = { version = "0.0.113", path = "../lightning", default-features = false, features = ["_test_utils"] }
+lightning = { version = "0.0.114", path = "../lightning", default-features = false, features = ["_test_utils"] }
hex = "0.4"
serde_json = { version = "1"}
use core::str;
use core::str::FromStr;
-use bech32;
use bech32::{u5, FromBase32};
+ use bitcoin::{PubkeyHash, ScriptHash};
+ use bitcoin::util::address::WitnessVersion;
use bitcoin_hashes::Hash;
use bitcoin_hashes::sha256;
use crate::prelude::*;
if bytes.len() < 2 || bytes.len() > 40 {
return Err(ParseError::InvalidSegWitProgramLength);
}
-
+ let version = WitnessVersion::try_from(version).expect("0 through 16 are valid SegWit versions");
Ok(Fallback::SegWitProgram {
- version: version,
+ version,
program: bytes
})
},
let builder = InvoiceBuilder::new(Currency::BitcoinTestnet)
.amount_milli_satoshis(123)
.duration_since_epoch(Duration::from_secs(1234567))
- .payee_pub_key(public_key.clone())
+ .payee_pub_key(public_key)
.expiry_time(Duration::from_secs(54321))
.min_final_cltv_expiry_delta(144)
- .fallback(Fallback::PubKeyHash([0;20]))
+ .fallback(Fallback::PubKeyHash(PubkeyHash::from_slice(&[0;20]).unwrap()))
.private_route(route_1.clone())
.private_route(route_2.clone())
.description_hash(sha256::Hash::from_slice(&[3;32][..]).unwrap())