Skip to content

Commit

Permalink
Implement burn for wallet command (#3437)
Browse files Browse the repository at this point in the history
  • Loading branch information
onchainguy-btc authored Sep 30, 2024
1 parent 0477b52 commit 9bc83eb
Show file tree
Hide file tree
Showing 17 changed files with 1,200 additions and 763 deletions.
2 changes: 2 additions & 0 deletions crates/mockcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub struct TransactionTemplate<'a> {
pub output_values: &'a [u64],
pub outputs: usize,
pub p2tr: bool,
pub receiver: Option<Address>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -185,6 +186,7 @@ impl<'a> Default for TransactionTemplate<'a> {
output_values: &[],
outputs: 1,
p2tr: false,
receiver: None,
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/mockcore/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ impl State {
.get(i)
.cloned()
.unwrap_or(value_per_output),
script_pubkey: if template.p2tr {
script_pubkey: if template.receiver.is_some() {
template.receiver.as_ref().unwrap().script_pubkey()
} else if template.p2tr {
let secp = Secp256k1::new();
let keypair = KeyPair::new(&secp, &mut rand::thread_rng());
let internal_key = XOnlyPublicKey::from_keypair(&keypair);
Expand Down
Loading

0 comments on commit 9bc83eb

Please sign in to comment.