-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce an example binary useful for profiling #646
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ec751fb
Introduce an example binary useful for profiling
RCasatta 883132e
add policy calls in big executable
RCasatta 959546b
add psbt finalize call in big executable
RCasatta 545bbbe
add satisfy call in big executable
RCasatta bc47538
add taproot calls in big executable
RCasatta c8d3b9a
fix formatting in big example
RCasatta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
//! This is not an example and will surely panic if executed, the purpose of this is using the | ||
//! compiled binary with tools like `cargo bloat` that cannot work with libraries. | ||
//! | ||
//! Ideal properties: | ||
//! | ||
//! * Call all the library API surface. | ||
//! * Depend on user input so that functions are not stripped out on the base of static input. | ||
//! * Use results so that calls are not stripped out. | ||
//! | ||
|
||
use std::str::FromStr; | ||
use miniscript::{DefiniteDescriptorKey, Descriptor, DescriptorPublicKey, MiniscriptKey}; | ||
use secp256k1::Secp256k1; | ||
fn main() { | ||
let empty = "".to_string(); | ||
let mut args = std::env::args().collect::<Vec<_>>(); | ||
let i = args.pop().unwrap_or(empty); | ||
|
||
let d = Descriptor::<DescriptorPublicKey>::from_str(&i).unwrap(); | ||
use_descriptor(d.clone()); | ||
use_descriptor(Descriptor::<DefiniteDescriptorKey>::from_str(&i).unwrap()); | ||
use_descriptor(Descriptor::<bitcoin::PublicKey>::from_str(&i).unwrap()); | ||
use_descriptor(Descriptor::<String>::from_str(&i).unwrap()); | ||
|
||
let a = d.at_derivation_index(0).unwrap().address(bitcoin::Network::Bitcoin).unwrap(); | ||
println!("{}", a); | ||
|
||
let secp = Secp256k1::new(); | ||
let (d, m) = Descriptor::parse_descriptor(&secp, &i).unwrap(); | ||
use_descriptor(d); | ||
println!("{:?}", m); | ||
} | ||
|
||
fn use_descriptor<K: MiniscriptKey>(d: Descriptor<K>) { | ||
println!("{}", d); | ||
println!("{:?}", d); | ||
println!("{:?}", d.desc_type()); | ||
println!("{:?}", d.sanity_check()); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ec751fb:
trailing space after
the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the formatter got this in the last commit.