mirror of
https://github.com/bitcoin/bips.git
synced 2026-03-09 15:53:54 +00:00
Review comments and assistance by: Armin Sabouri <armins88@gmail.com> D++ <82842780+dplusplus1024@users.noreply.github.com> Jameson Lopp <jameson.lopp@gmail.com> jbride <jbride2001@yahoo.com> Joey Yandle <xoloki@gmail.com> Jon Atack <jon@atack.com> Jonas Nick <jonasd.nick@gmail.com> Kyle Crews <kylecrews@Kyles-Mac-Studio.local> Mark "Murch" Erhardt <murch@murch.one> notmike-5 <notmike-5@users.noreply.github.com> Vojtěch Strnad <43024885+vostrnad@users.noreply.github.com> Co-authored-by: Ethan Heilman <ethan.r.heilman@gmail.com> Co-authored-by: Isabel Foxen Duke <110147802+Isabelfoxenduke@users.noreply.github.com>
28 lines
1.2 KiB
Rust
28 lines
1.2 KiB
Rust
use p2mr_ref::{create_p2mr_utxo, create_p2mr_multi_leaf_taptree, tap_tree_lock_type};
|
|
use p2mr_ref::data_structures::{UtxoReturn, TaptreeReturn, ConstructionReturn, LeafScriptType};
|
|
use std::env;
|
|
use log::{info, error};
|
|
|
|
// Inspired by: https://learnmeabitcoin.com/technical/upgrades/taproot/#example-3-script-path-spend-signature
|
|
fn main() -> ConstructionReturn {
|
|
|
|
let _ = env_logger::try_init(); // Use try_init to avoid reinitialization error
|
|
|
|
let tap_tree_lock_type = tap_tree_lock_type();
|
|
info!("tap_tree_lock_type: {:?}", tap_tree_lock_type);
|
|
|
|
let taptree_return: TaptreeReturn = create_p2mr_multi_leaf_taptree();
|
|
let p2mr_utxo_return: UtxoReturn = create_p2mr_utxo(taptree_return.clone().tree_root_hex);
|
|
|
|
// Alert user about SPENDING_LEAF_TYPE requirement when using MIXED mode
|
|
if tap_tree_lock_type == LeafScriptType::Mixed {
|
|
info!("NOTE: TAP_TREE_LOCK_TYPE=MIXED requires setting SPENDING_LEAF_TYPE when spending (based on leaf_script_type in output above) as follows:");
|
|
info!(" export SPENDING_LEAF_TYPE={}", taptree_return.leaf_script_type);
|
|
}
|
|
|
|
return ConstructionReturn {
|
|
taptree_return: taptree_return,
|
|
utxo_return: p2mr_utxo_return,
|
|
};
|
|
}
|