Major refactor of the Esplora client
Now we're back to using regular bdk types, which is a big advantage.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use bdk_wallet::miniscript::descriptor::Wsh;
|
||||
use bdk_wallet::miniscript::policy::{self, Concrete, Liftable};
|
||||
use bdk::miniscript::{descriptor::Wsh, policy::Concrete};
|
||||
use bitcoin::Address;
|
||||
|
||||
/// A hash time locked contract between two parties.
|
||||
@@ -35,8 +34,8 @@ impl Htlc {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn to_miniscript_policy(&self) -> policy::Concrete<bitcoin::PublicKey> {
|
||||
Concrete::<bitcoin::PublicKey>::from_str(&format!(
|
||||
pub(crate) fn to_miniscript_policy(&self) -> Concrete<bdk::bitcoin::PublicKey> {
|
||||
Concrete::<bdk::bitcoin::PublicKey>::from_str(&format!(
|
||||
"or(10@and(sha256({secret_hash}),pk({redeem_identity})),1@and(older({expiry}),pk({refund_identity})))",
|
||||
secret_hash = self.hashlock,
|
||||
redeem_identity = self.redeem_identity,
|
||||
@@ -45,7 +44,7 @@ impl Htlc {
|
||||
)).expect("Policy compilation only fails on resource limits or mixed timelocks")
|
||||
}
|
||||
|
||||
pub(crate) fn to_miniscript_descriptor(&self) -> Wsh<bitcoin::PublicKey> {
|
||||
pub(crate) fn to_miniscript_descriptor(&self) -> Wsh<bdk::bitcoin::PublicKey> {
|
||||
Wsh::new(
|
||||
self.to_miniscript_policy()
|
||||
.compile()
|
||||
|
||||
Reference in New Issue
Block a user