Skip to content

Commit 41591f4

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 6edca6b commit 41591f4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/bin/hal/cmd/psbt.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,16 +454,15 @@ fn cmd_rawsign<'a>() -> clap::App<'a, 'a> {
454454
args::arg("psbt", "PSBT to finalize, either base64/hex or a file path").required(false),
455455
args::arg("input-idx", "the input index to edit").required(true),
456456
args::arg("priv-key", "the private key in WIF/hex").required(true),
457-
args::arg("compressed", "Whether the corresponding pk is compressed")
458-
.required(false)
459-
.default_value("true"),
460457
args::opt("raw-stdout", "output the raw bytes of the result to stdout")
461458
.short("r")
462459
.required(false),
463460
args::opt("output", "where to save the resulting PSBT file -- in place if omitted")
464461
.short("o")
465462
.takes_value(true)
466463
.required(false),
464+
args::opt("uncompressed", "Whether the corresponding pubkey should be used uncompressed")
465+
.takes_value(false),
467466
])
468467
}
469468

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

481479
if i >= psbt.inputs.len() {
482480
panic!("PSBT input index out of range")
@@ -487,7 +485,7 @@ fn exec_rawsign<'a>(args: &clap::ArgMatches<'a>) {
487485

488486
let pk = secp256k1::PublicKey::from_secret_key(&SECP, &sk);
489487
let pk = bitcoin::PublicKey {
490-
compressed: compressed,
488+
compressed: !uncompressed,
491489
inner: pk,
492490
};
493491
let msg = psbt.sighash_msg(i, &mut cache, None)

0 commit comments

Comments
 (0)