Skip to content

psbt: Replace optional argument compressed with flag --uncompressed #44

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/bin/hal/cmd/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,11 @@ fn cmd_rawsign<'a>() -> clap::App<'a, 'a> {
args::arg("psbt", "PSBT to finalize, either base64/hex or a file path").required(false),
args::arg("input-idx", "the input index to edit").required(true),
args::arg("priv-key", "the private key in WIF/hex").required(true),
args::flag("compressed", "Whether the corresponding pk is compressed")
.required(false)
.default_value("true"),
args::flag("raw-stdout", "output the raw bytes of the result to stdout")
.short("r"),
args::opt("output", "where to save the resulting PSBT file -- in place if omitted")
.short("o"),
args::opt("uncompressed", "Whether the corresponding pubkey should be used uncompressed"),
])
}

Expand All @@ -436,8 +434,7 @@ fn exec_rawsign<'a>(args: &clap::ArgMatches<'a>) {
let sk = args.need_privkey("priv-key").inner;
let i = args.value_of("input-idx").need("Input index not provided")
.parse::<usize>().need("input-idx must be a positive integer");
let compressed = args.value_of("compressed").unwrap()
.parse::<bool>().need("Compressed must be boolean");
let uncompressed = args.is_present("uncompressed");

if i >= psbt.inputs.len() {
panic!("PSBT input index out of range")
Expand All @@ -448,7 +445,7 @@ fn exec_rawsign<'a>(args: &clap::ArgMatches<'a>) {

let pk = secp256k1::PublicKey::from_secret_key(&SECP, &sk);
let pk = bitcoin::PublicKey {
compressed: compressed,
compressed: !uncompressed,
inner: pk,
};
let msg = psbt.sighash_msg(i, &mut cache, None)
Expand Down