hsmtool: remove threshold arg.
It really has to be 0, since it's the complete secret. And we didn't handle it well, (`a` would be treated as 0, for example!). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4dcd712d6e
commit
5900742b3a
|
@ -1359,7 +1359,7 @@ def test_recover(node_factory, bitcoind):
|
|||
out = subprocess.check_output(cmd_line + ["leet", "0"]).decode('utf-8')
|
||||
assert out == "ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqqtum9pgv99ycma\n"
|
||||
|
||||
# Check bad ids, threshold.
|
||||
# Check bad ids.
|
||||
out = subprocess.run(cmd_line + ["lee", "0"], stderr=subprocess.PIPE, timeout=TIMEOUT)
|
||||
assert 'Invalid id: must be 4 characters' in out.stderr.decode('utf-8')
|
||||
assert out.returncode == 2
|
||||
|
@ -1377,14 +1377,6 @@ def test_recover(node_factory, bitcoind):
|
|||
assert 'Invalid id: must be valid bech32 string' in out.stderr.decode('utf-8')
|
||||
assert out.returncode == 2
|
||||
|
||||
out = subprocess.run(cmd_line + ["leet", "1"], stderr=subprocess.PIPE, timeout=TIMEOUT)
|
||||
assert 'Invalid threshold 1' in out.stderr.decode('utf-8')
|
||||
assert out.returncode == 2
|
||||
|
||||
out = subprocess.run(cmd_line + ["leet", "99"], stderr=subprocess.PIPE, timeout=TIMEOUT)
|
||||
assert 'Invalid threshold 99' in out.stderr.decode('utf-8')
|
||||
assert out.returncode == 2
|
||||
|
||||
basedir = l1.daemon.opts.get("lightning-dir")
|
||||
with open(os.path.join(basedir, TEST_NETWORK, 'hsm_secret'), 'rb') as f:
|
||||
buff = f.read()
|
||||
|
|
|
@ -45,7 +45,7 @@ static void show_usage(const char *progname)
|
|||
printf(" - checkhsm <path/to/new/hsm_secret>\n");
|
||||
printf(" - dumponchaindescriptors <path/to/hsm_secret> [network]\n");
|
||||
printf(" - makerune <path/to/hsm_secret>\n");
|
||||
printf(" - getcodexsecret <path/to/hsm_secret> <id> <threshold>\n");
|
||||
printf(" - getcodexsecret <path/to/hsm_secret> <id>\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -247,15 +247,14 @@ static int decrypt_hsm(const char *hsm_secret_path)
|
|||
}
|
||||
|
||||
static int make_codexsecret(const char *hsm_secret_path,
|
||||
const char *id,
|
||||
const u32 threshold)
|
||||
const char *id)
|
||||
{
|
||||
struct secret hsm_secret;
|
||||
char *bip93;
|
||||
const char *err;
|
||||
get_hsm_secret(&hsm_secret, hsm_secret_path);
|
||||
|
||||
err = codex32_secret_encode(tmpctx, id, threshold, hsm_secret.data, 32, &bip93);
|
||||
err = codex32_secret_encode(tmpctx, id, 0, hsm_secret.data, 32, &bip93);
|
||||
if (err)
|
||||
errx(ERROR_USAGE, "%s", err);
|
||||
|
||||
|
@ -765,9 +764,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if(streq(method, "getcodexsecret")) {
|
||||
if (argc < 3)
|
||||
if (argc < 2)
|
||||
show_usage(argv[0]);
|
||||
return make_codexsecret(argv[2], argv[3], atol(argv[4]));
|
||||
return make_codexsecret(argv[2], argv[3]);
|
||||
}
|
||||
show_usage(argv[0]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue