Skip to content

Commit 835d65e

Browse files
committed
psbt: Replace optional argument compressed with flag --uncompressed
Using uncompressed keys is so uncommon it shouldn't be a full argument.
1 parent 8ecde42 commit 835d65e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/bin/hal/cmd/psbt.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,11 @@ fn cmd_rawsign<'a>() -> clap::App<'a, 'a> {
418418
args::arg("psbt", "PSBT to finalize, either base64/hex or a file path").required(false),
419419
args::arg("input-idx", "the input index to edit").required(true),
420420
args::arg("priv-key", "the private key in WIF/hex").required(true),
421-
args::flag("compressed", "Whether the corresponding pk is compressed")
422-
.required(false)
423-
.default_value("true"),
424421
args::flag("raw-stdout", "output the raw bytes of the result to stdout")
425422
.short("r"),
426423
args::opt("output", "where to save the resulting PSBT file -- in place if omitted")
427424
.short("o"),
425+
args::opt("uncompressed", "Whether the corresponding pubkey should be used uncompressed"),
428426
])
429427
}
430428

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

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

449446
let pk = secp256k1::PublicKey::from_secret_key(&SECP, &sk);
450447
let pk = bitcoin::PublicKey {
451-
compressed: compressed,
448+
compressed: !uncompressed,
452449
inner: pk,
453450
};
454451
let msg = psbt.sighash_msg(i, &mut cache, None)

0 commit comments

Comments
 (0)