[cli] Add a flag to build PSBTs for offline signers
The `--offline_signer` flag forces the addition of `non_witness_utxo` and the full witness and redeem script for every output, which makes it easier for the signer to identify the change output. Closes #199
This commit is contained in:
parent
59482f795b
commit
e1a59336f8
24
src/cli.rs
24
src/cli.rs
@ -163,6 +163,12 @@ pub fn make_cli_subcommands<'a, 'b>() -> App<'a, 'b> {
|
|||||||
.help("Selects which policy should be used to satisfy the internal descriptor")
|
.help("Selects which policy should be used to satisfy the internal descriptor")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.number_of_values(1),
|
.number_of_values(1),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("offline_signer")
|
||||||
|
.long("offline_signer")
|
||||||
|
.help("Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of `non_witness_utxo` and more details to let the signer identify the change output.")
|
||||||
|
.takes_value(false),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
@ -210,6 +216,12 @@ pub fn make_cli_subcommands<'a, 'b>() -> App<'a, 'b> {
|
|||||||
.value_name("SATS_VBYTE")
|
.value_name("SATS_VBYTE")
|
||||||
.help("The new targeted fee rate in sat/vbyte")
|
.help("The new targeted fee rate in sat/vbyte")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("offline_signer")
|
||||||
|
.long("offline_signer")
|
||||||
|
.help("Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of `non_witness_utxo` and more details to let the signer identify the change output.")
|
||||||
|
.takes_value(false),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
@ -444,6 +456,12 @@ where
|
|||||||
tx_builder = tx_builder.enable_rbf();
|
tx_builder = tx_builder.enable_rbf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sub_matches.is_present("offline_signer") {
|
||||||
|
tx_builder = tx_builder
|
||||||
|
.force_non_witness_utxo()
|
||||||
|
.include_output_redeem_witness_script();
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(fee_rate) = sub_matches.value_of("fee_rate") {
|
if let Some(fee_rate) = sub_matches.value_of("fee_rate") {
|
||||||
let fee_rate = f32::from_str(fee_rate).map_err(|s| Error::Generic(s.to_string()))?;
|
let fee_rate = f32::from_str(fee_rate).map_err(|s| Error::Generic(s.to_string()))?;
|
||||||
tx_builder = tx_builder.fee_rate(FeeRate::from_sat_per_vb(fee_rate));
|
tx_builder = tx_builder.fee_rate(FeeRate::from_sat_per_vb(fee_rate));
|
||||||
@ -495,6 +513,12 @@ where
|
|||||||
tx_builder = tx_builder.maintain_single_recipient();
|
tx_builder = tx_builder.maintain_single_recipient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sub_matches.is_present("offline_signer") {
|
||||||
|
tx_builder = tx_builder
|
||||||
|
.force_non_witness_utxo()
|
||||||
|
.include_output_redeem_witness_script();
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(utxos) = sub_matches.values_of("utxos") {
|
if let Some(utxos) = sub_matches.values_of("utxos") {
|
||||||
let utxos = utxos
|
let utxos = utxos
|
||||||
.map(|i| parse_outpoint(i))
|
.map(|i| parse_outpoint(i))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user