mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pytest: reproduce issue #4302
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
parent
dd1def335c
commit
aa2586a45a
@ -1097,6 +1097,39 @@ def test_hsmtool_dump_descriptors(node_factory, bitcoind):
|
||||
assert len(bitcoind.rpc.listunspent(1, 1, [addr])) == 1
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
@unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.")
|
||||
def test_hsmtool_generatehsm(node_factory):
|
||||
l1 = node_factory.get_node()
|
||||
l1.stop()
|
||||
hsm_path = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK,
|
||||
"hsm_secret")
|
||||
master_fd, slave_fd = os.openpty()
|
||||
|
||||
hsmtool = HsmTool("generatehsm", hsm_path)
|
||||
# You cannot re-generate an already existing hsm_secret
|
||||
hsmtool.start(stdin=slave_fd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
assert hsmtool.proc.wait(5) == 2
|
||||
os.remove(hsm_path)
|
||||
|
||||
# We can generate a valid hsm_secret from a wordlist and a "passphrase"
|
||||
hsmtool.start(stdin=slave_fd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
hsmtool.wait_for_log(r"Select your language:")
|
||||
os.write(master_fd, "0\n".encode("utf-8"))
|
||||
hsmtool.wait_for_log(r"Introduce your BIP39 word list")
|
||||
os.write(master_fd, "ritual idle hat sunny universe pluck key alpha wing "
|
||||
"cake have wedding\n".encode("utf-8"))
|
||||
hsmtool.wait_for_log(r"Enter your passphrase:")
|
||||
os.write(master_fd, "This is actually not a passphrase\n".encode("utf-8"))
|
||||
hsmtool.proc.wait(5)
|
||||
hsmtool.is_in_log(r"New hsm_secret file created")
|
||||
|
||||
# We can start the node with this hsm_secret
|
||||
l1.start()
|
||||
|
||||
|
||||
# this test does a 'listtransactions' on a yet unconfirmed channel
|
||||
def test_fundchannel_listtransaction(node_factory, bitcoind):
|
||||
l1, l2 = node_factory.get_nodes(2)
|
||||
|
@ -461,6 +461,7 @@ static void get_words(struct words **words) {
|
||||
printf(" %zu) %s (%s)\n", i, languages[i].name, languages[i].abbr);
|
||||
}
|
||||
printf("Select [0-%zu]: ", ARRAY_SIZE(languages));
|
||||
fflush(stdout);
|
||||
|
||||
char *selected = NULL;
|
||||
size_t size = 0;
|
||||
@ -483,6 +484,7 @@ static void get_mnemonic(char *mnemonic) {
|
||||
size_t line_size = 0;
|
||||
|
||||
printf("Introduce your BIP39 word list separated by space:\n");
|
||||
fflush(stdout);
|
||||
size_t characters = getline(&line, &line_size, stdin);
|
||||
if (characters < 0)
|
||||
errx(ERROR_USAGE, "Could not read line from stdin.");
|
||||
|
Loading…
Reference in New Issue
Block a user