@@ -1532,16 +1532,17 @@ def test_hsmtool_checkhsm_with_passphrase(node_factory):
15321532 hsmtool = HsmTool (node_factory .directory , "checkhsm" , hsm_path )
15331533 master_fd , slave_fd = os .openpty ()
15341534 hsmtool .start (stdin = slave_fd )
1535- hsmtool .wait_for_log (r"Enter hsm_secret password:" ) # Unlock file
1535+ hsmtool .wait_for_log (r"Enter hsm_secret password:" ) # Decrypt file
15361536 write_all (master_fd , "secret_passphrase\n " .encode ("utf-8" ))
1537- hsmtool .wait_for_log (r"Enter your passphrase:" ) # Verification passphrase
1537+ hsmtool .wait_for_log (r"Enter your passphrase:" ) # Backup verification
15381538 write_all (master_fd , "secret_passphrase\n " .encode ("utf-8" ))
15391539 hsmtool .wait_for_log (r"Introduce your BIP39 word list" )
15401540 write_all (master_fd , "ritual idle hat sunny universe pluck key alpha wing cake have wedding\n " .encode ("utf-8" ))
15411541 assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
15421542 hsmtool .is_in_log (r"OK" )
15431543
15441544
1545+
15451546def test_hsmtool_checkhsm_no_passphrase (node_factory ):
15461547 """Test checkhsm with mnemonic that has no passphrase"""
15471548 l1 = node_factory .get_node (start = False )
@@ -2059,8 +2060,6 @@ def test_hsmtool_makerune(node_factory):
20592060 hsmtool = HsmTool (node_factory .directory , "generatehsm" , hsm_path )
20602061 master_fd , slave_fd = os .openpty ()
20612062 hsmtool .start (stdin = slave_fd )
2062- hsmtool .wait_for_log (r"Select your language:" )
2063- write_all (master_fd , "0\n " .encode ("utf-8" ))
20642063 hsmtool .wait_for_log (r"Introduce your BIP39 word list" )
20652064 write_all (master_fd , "ritual idle hat sunny universe pluck key alpha wing "
20662065 "cake have wedding\n " .encode ("utf-8" ))
@@ -2069,8 +2068,14 @@ def test_hsmtool_makerune(node_factory):
20692068 assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
20702069 hsmtool .is_in_log (r"New hsm_secret file created" )
20712070
2072- cmd_line = ["tools/hsmtool" , "makerune" , hsm_path ]
2073- out = subprocess .check_output (cmd_line ).decode ("utf8" ).split ("\n " )[0 ]
2071+ # Test makerune with the passphrase
2072+ hsmtool = HsmTool (node_factory .directory , "makerune" , hsm_path )
2073+ master_fd , slave_fd = os .openpty ()
2074+ hsmtool .start (stdin = slave_fd )
2075+ hsmtool .wait_for_log (r"Enter hsm_secret password:" )
2076+ write_all (master_fd , "This is actually not a passphrase\n " .encode ("utf-8" ))
2077+ assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
2078+ out = hsmtool .logs .split ("\n " )[- 2 ] # Get the rune output (last line before empty line)
20742079
20752080 l1 .start ()
20762081
0 commit comments