Skip to content

Commit dd4f4d7

Browse files
authored
Backport: fix/datatool-hardened-derivation to 0.2.0 (#951)
* Backport: fix/datatool-hardened-derivation to 0.2.0 * fix: cargo.lock
1 parent 57c27bb commit dd4f4d7

File tree

11 files changed

+166
-259
lines changed

11 files changed

+166
-259
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/datatool/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ rand_core.workspace = true
2525
reth-chainspec.workspace = true
2626
secp256k1 = { workspace = true, features = ["global-context", "std"] }
2727
serde_json.workspace = true
28+
shrex.workspace = true
2829
terrors = "0.3.0"
2930
zeroize.workspace = true
3031

bin/datatool/src/args.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ pub(crate) struct SubcOpXpub {
103103
short = 'E'
104104
)]
105105
pub(crate) key_from_env: bool,
106+
107+
#[argh(switch, description = "print the p2p key", short = 'p')]
108+
pub(crate) p2p: bool,
109+
110+
#[argh(switch, description = "print the wallet key", short = 'w')]
111+
pub(crate) wallet: bool,
106112
}
107113

108114
/// Generate a network's param file from inputs.
@@ -148,14 +154,14 @@ pub(crate) struct SubcParams {
148154

149155
#[argh(
150156
option,
151-
description = "add a bridge operator key (must be at least one, appended after file keys)",
157+
description = "add a bridge operator key (master xpriv, must be at least one, appended after file keys)",
152158
short = 'b'
153159
)]
154160
pub(crate) opkey: Vec<String>,
155161

156162
#[argh(
157163
option,
158-
description = "read bridge operator keys by line from file",
164+
description = "read bridge operator keys (master xpriv) by line from file",
159165
short = 'B'
160166
)]
161167
pub(crate) opkeys: Option<PathBuf>,

bin/datatool/src/main.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@ use util::{exec_subc, resolve_network};
1515

1616
fn main() {
1717
let args: args::Args = argh::from_env();
18-
if let Err(e) = main_inner(args) {
19-
eprintln!("ERROR\n{e:?}");
20-
}
21-
}
18+
let inner = || -> anyhow::Result<()> {
19+
let network = resolve_network(args.bitcoin_network.as_deref())?;
2220

23-
fn main_inner(args: args::Args) -> anyhow::Result<()> {
24-
let network = resolve_network(args.bitcoin_network.as_deref())?;
21+
let mut ctx = CmdContext {
22+
datadir: args.datadir.unwrap_or_else(|| PathBuf::from(".")),
23+
bitcoin_network: network,
24+
rng: OsRng,
25+
};
2526

26-
let mut ctx = CmdContext {
27-
datadir: args.datadir.unwrap_or_else(|| PathBuf::from(".")),
28-
bitcoin_network: network,
29-
rng: OsRng,
27+
exec_subc(args.subc, &mut ctx)?;
28+
Ok(())
3029
};
31-
32-
exec_subc(args.subc, &mut ctx)?;
33-
Ok(())
30+
if let Err(e) = inner() {
31+
eprintln!("ERROR\n{e:?}");
32+
}
3433
}

0 commit comments

Comments
 (0)