Fixes to miniscript descriptor
This commit is contained in:
@@ -20,7 +20,6 @@ pub(crate) async fn run() -> anyhow::Result<()> {
|
||||
|
||||
// format a new commitment transaction like in Lightning
|
||||
let mut commitment_builder = dave.wallet.build_tx();
|
||||
commitment_builder.add_recipient(recipient, value);
|
||||
commitment_builder.enable_rbf();
|
||||
let (psbt, _) = commitment_builder
|
||||
.finish()
|
||||
|
||||
@@ -12,7 +12,7 @@ pub(crate) async fn run() -> anyhow::Result<()> {
|
||||
|
||||
tracing::info!("starting transfer policy flow");
|
||||
|
||||
let policy_str = format!("pk2wsh({:?})", dave.public_key);
|
||||
let policy_str = format!("addr(bc1qgw6xanldsz959z45y4dszehx4xkuzf7nfhya8x)");
|
||||
|
||||
let policy = policy::Concrete::<bdk::bitcoin::PublicKey>::from_str(&policy_str)
|
||||
.expect("policy compilation failed")
|
||||
|
||||
@@ -33,7 +33,7 @@ impl Htlc {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn to_miniscript_descriptor(&self) -> Wsh<bdk::bitcoin::PublicKey> {
|
||||
pub(crate) fn to_miniscript_descriptor(&self) -> Wsh<String> {
|
||||
let htlc_descriptor = Wsh::new(
|
||||
self.to_miniscript_policy()
|
||||
.compile()
|
||||
@@ -46,8 +46,8 @@ impl Htlc {
|
||||
htlc_descriptor
|
||||
}
|
||||
|
||||
fn to_miniscript_policy(&self) -> Concrete<bdk::bitcoin::PublicKey> {
|
||||
Concrete::<bdk::bitcoin::PublicKey>::from_str(&format!(
|
||||
fn to_miniscript_policy(&self) -> Concrete<String> {
|
||||
Concrete::<String>::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,
|
||||
|
||||
@@ -21,7 +21,7 @@ pub(crate) enum Commands {
|
||||
BtcTransfer {},
|
||||
|
||||
/// transfers bitcoin but this time uses a Miniscript policy
|
||||
BtcTransferPolicy {},
|
||||
BtcPolicyTransfer {},
|
||||
|
||||
/// sets up a Bitcoin HTLC
|
||||
BtcHtlc {},
|
||||
|
||||
Reference in New Issue
Block a user