|
|
|
@ -9,12 +9,15 @@ from electrum.lnutil import (RevocationStore, get_per_commitment_secret_from_see |
|
|
|
derive_pubkey, make_htlc_tx, extract_ctn_from_tx, UnableToDeriveSecret, |
|
|
|
derive_pubkey, make_htlc_tx, extract_ctn_from_tx, UnableToDeriveSecret, |
|
|
|
get_compressed_pubkey_from_bech32, split_host_port, ConnStringFormatError, |
|
|
|
get_compressed_pubkey_from_bech32, split_host_port, ConnStringFormatError, |
|
|
|
ScriptHtlc, extract_nodeid, calc_fees_for_commitment_tx, UpdateAddHtlc, LnFeatures, |
|
|
|
ScriptHtlc, extract_nodeid, calc_fees_for_commitment_tx, UpdateAddHtlc, LnFeatures, |
|
|
|
ln_compare_features, IncompatibleLightningFeatures, ChannelType) |
|
|
|
ln_compare_features, IncompatibleLightningFeatures, ChannelType, |
|
|
|
|
|
|
|
ImportedChannelBackupStorage) |
|
|
|
from electrum.util import bfh, MyEncoder |
|
|
|
from electrum.util import bfh, MyEncoder |
|
|
|
from electrum.transaction import Transaction, PartialTransaction, Sighash |
|
|
|
from electrum.transaction import Transaction, PartialTransaction, Sighash |
|
|
|
from electrum.lnworker import LNWallet |
|
|
|
from electrum.lnworker import LNWallet |
|
|
|
|
|
|
|
from electrum.wallet import restore_wallet_from_text, Standard_Wallet |
|
|
|
|
|
|
|
from electrum.simple_config import SimpleConfig |
|
|
|
|
|
|
|
|
|
|
|
from . import ElectrumTestCase |
|
|
|
from . import ElectrumTestCase, as_testnet |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funding_tx_id = '8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be' |
|
|
|
funding_tx_id = '8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be' |
|
|
|
@ -903,3 +906,29 @@ class TestLNUtil(ElectrumTestCase): |
|
|
|
# ignore unknown channel types |
|
|
|
# ignore unknown channel types |
|
|
|
channel_type = ChannelType(0b10000000001000000000010).discard_unknown_and_check() |
|
|
|
channel_type = ChannelType(0b10000000001000000000010).discard_unknown_and_check() |
|
|
|
self.assertEqual(ChannelType(0b10000000001000000000000), channel_type) |
|
|
|
self.assertEqual(ChannelType(0b10000000001000000000000), channel_type) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@as_testnet |
|
|
|
|
|
|
|
async def test_decode_imported_channel_backup(self): |
|
|
|
|
|
|
|
encrypted_cb = "channel_backup:Adn87xcGIs9H2kfp4VpsOaNKWCHX08wBoqq37l1cLYKGlJamTeoaLEwpJA81l1BXF3GP/mRxqkY+whZG9l51G8izIY/kmMSvnh0DOiZEdwaaT/1/MwEHfsEomruFqs+iW24SFJPHbMM7f80bDtIxcLfZkKmgcKBAOlcqtq+dL3U3yH74S8BDDe2L4snaxxpCjF0JjDMBx1UR/28D+QlIi+lbvv1JMaCGXf+AF1+3jLQf8+lVI+rvFdyArws6Ocsvjf+ANQeSGUwW6Nb2xICQcMRgr1DO7bO4pgGu408eYRr2v3ayJBVtnKwSwd49gF5SDSjTDAO4CCM0uj9H5RxyzH7fqotkd9J80MBr84RiBXAeXKz+Ap8608/FVqgQ9BOcn6LhuAQdE5zXpmbQyw5jUGkPvHuseR+rzthzncy01odUceqTNg==" |
|
|
|
|
|
|
|
config = SimpleConfig({'electrum_path': self.electrum_path}) |
|
|
|
|
|
|
|
d = restore_wallet_from_text("9dk", path=None, gap_limit=2, config=config) |
|
|
|
|
|
|
|
wallet1 = d['wallet'] # type: Standard_Wallet |
|
|
|
|
|
|
|
decoded_cb = ImportedChannelBackupStorage.from_encrypted_str(encrypted_cb, password=wallet1.get_fingerprint()) |
|
|
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
|
|
ImportedChannelBackupStorage( |
|
|
|
|
|
|
|
funding_txid='97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe', |
|
|
|
|
|
|
|
funding_index=1, |
|
|
|
|
|
|
|
funding_address='tb1qfsxllwl2edccpar9jas9wsxd4vhcewlxqwmn0w27kurkme3jvkdqn4msdp', |
|
|
|
|
|
|
|
is_initiator=True, |
|
|
|
|
|
|
|
node_id=bfh('02bf82e22f99dcd7ac1de4aad5152ce48f0694c46ec582567f379e0adbf81e2d0f'), |
|
|
|
|
|
|
|
privkey=bfh('7e634853dc47f0bc2f2e0d1054b302fcb414371ddbd889f29ba8aa4e8b62c772'), |
|
|
|
|
|
|
|
host='lightning.electrum.org', |
|
|
|
|
|
|
|
port=9739, |
|
|
|
|
|
|
|
channel_seed=bfh('ce9bad44ff8521d9f57fd202ad7cdedceb934f0056f42d0f3aa7a576b505332a'), |
|
|
|
|
|
|
|
local_delay=1008, |
|
|
|
|
|
|
|
remote_delay=720, |
|
|
|
|
|
|
|
remote_payment_pubkey=bfh('02a1bbc818e2e88847016a93c223eb4adef7bb8becb3709c75c556b6beb3afe7bd'), |
|
|
|
|
|
|
|
remote_revocation_pubkey=bfh('022f28b7d8d1f05768ada3df1b0966083b8058e1e7197c57393e302ec118d7f0ae'), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
decoded_cb, |
|
|
|
|
|
|
|
) |
|
|
|
|