mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
Add test for handling old emergency.recover file format
This commit introduces a test to verify that we can still process the old emergency.recover file format. This ensures backward compatibility and proper handling of legacy recovery files. Key Changes: - Get the encrypted emergency.recover file for l1 from the current master branch. - Replace the emergency.recover data with the new encrypted_data. - Add an assertion to check if the funding transaction output (TXO) of the channel is being watched.
This commit is contained in:
parent
2994f2b3ea
commit
46ba180f94
1 changed files with 29 additions and 0 deletions
|
@ -2883,6 +2883,35 @@ def test_getemergencyrecoverdata(node_factory):
|
|||
assert lines == filedata
|
||||
|
||||
|
||||
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "deletes database, which is assumed sqlite3")
|
||||
def test_emergency_recover_old_format_handling(node_factory, bitcoind):
|
||||
"""
|
||||
Test test_emergency_recover_old_format_handling
|
||||
"""
|
||||
l1 = node_factory.get_node()
|
||||
|
||||
encrypted_data = (
|
||||
"4e90ed80be3ddf666967ecdebc296cb0ec9f9f2e1adf3b1ef359d74ae40dd152"
|
||||
"167572828e682105992d4cabe8b11edafe5069143950262ad42efa2cb629d7e9"
|
||||
"b990c9c3de2fc3cc30ef13cfa94cd4f5a9f9a70ea7837f3d0bbd5442c5086d34"
|
||||
"f0bc4d4343c9309109afa9350dc869f3eed66a4f52a46674bbe5bc4aedffd358"
|
||||
"5d8522c96739b9db57a00f8cc17a0221f72f1fd8c1b661f34eed33cde97c84e0"
|
||||
"43dc2abc7d862f49949d7a904a56b2fefef3bf0fd56a32635c8d23"
|
||||
)
|
||||
|
||||
os.unlink(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "emergency.recover"))
|
||||
|
||||
with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "emergency.recover"), 'wb') as f:
|
||||
f.write(bytes.fromhex(encrypted_data))
|
||||
|
||||
stubs = l1.rpc.emergencyrecover()["stubs"]
|
||||
assert len(stubs) == 1
|
||||
assert stubs[0] == '3497625a774a5e1839f1a4a6b23a6a06493817ae90ff4ed0a536f4202845de2f'
|
||||
assert l1.daemon.is_in_log('Watching for funding txid: 2fde452820f436a5d04eff90ae173849066a3ab2a6a4f139185e4a775a629734')
|
||||
assert l1.daemon.is_in_log('Processing legacy emergency.recover file format. *')
|
||||
l1.stop()
|
||||
|
||||
|
||||
def test_emergencyrecoverpenaltytxn(node_factory, bitcoind):
|
||||
l1, l2 = node_factory.get_nodes(2, [{'broken_log': r"onchaind-chan#[0-9]*: Could not find resolution for output .*: did \*we\* cheat\?",
|
||||
'may_reconnect': True,
|
||||
|
|
Loading…
Add table
Reference in a new issue