commit 8e753f998a0e107ae1b6b4fe54381ceb811421c3
parent a3c6f82bb244b9de44cd2aeae3d0178740309179
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 2 Feb 2019 09:58:31 +0100
fix tests
Diffstat:
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/electrum/lnbase.py b/electrum/lnbase.py
@@ -30,10 +30,10 @@ from .lnchan import Channel, RevokeAndAck, htlcsum
from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc,
RemoteConfig, OnlyPubkeyKeypair, ChannelConstraints, RevocationStore,
funding_output_script, get_per_commitment_secret_from_seed,
- secret_to_pubkey, LNPeerAddr, PaymentFailure, LnLocalFeatures,
+ secret_to_pubkey, PaymentFailure, LnLocalFeatures,
LOCAL, REMOTE, HTLCOwner, generate_keypair, LnKeyFamily,
get_ln_flag_pair_of_bit, privkey_to_pubkey, UnknownPaymentHash, MIN_FINAL_CLTV_EXPIRY_ACCEPTED,
- LightningPeerConnectionClosed, HandshakeFailed, LNPeerAddr, NotFoundChanAnnouncementForUpdate,
+ LightningPeerConnectionClosed, HandshakeFailed, NotFoundChanAnnouncementForUpdate,
MINIMUM_MAX_HTLC_VALUE_IN_FLIGHT_ACCEPTED, MAXIMUM_HTLC_MINIMUM_MSAT_ACCEPTED,
MAXIMUM_REMOTE_TO_SELF_DELAY_ACCEPTED)
from .lntransport import LNTransport, LNTransportBase
diff --git a/electrum/tests/test_lntransport.py b/electrum/tests/test_lntransport.py
@@ -1,5 +1,6 @@
from electrum.ecc import ECPrivkey
import asyncio
+from electrum.lnutil import LNPeerAddr
from electrum.lntransport import LNResponderTransport, LNTransport
from unittest import TestCase
@@ -46,8 +47,8 @@ class TestLNTransport(TestCase):
server_future = asyncio.ensure_future(asyncio.start_server(cb, '127.0.0.1', 42898))
l.run_until_complete(server_future)
async def connect():
- reader, writer = await asyncio.open_connection('127.0.0.1', 42898)
- t = LNTransport(initiator_key.get_secret_bytes(), responder_key.get_public_key_bytes(), reader, writer)
+ peer_addr = LNPeerAddr('127.0.0.1', 42898, responder_key.get_public_key_bytes())
+ t = LNTransport(initiator_key.get_secret_bytes(), peer_addr)
await t.handshake()
t.send_bytes(b'hello from client')
self.assertEqual(await t.read_messages().__anext__(), b'hello from server')
diff --git a/electrum/tests/test_lnwatcher/breach.sh b/electrum/tests/test_lnwatcher/breach.sh
@@ -4,7 +4,7 @@ set -eux pipefail
bitcoin-cli generatetoaddress 109 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null
sleep 30
othernode=$(./run_electrum --regtest -D /tmp/elec2 nodeid)
-./run_electrum --regtest -D /tmp/elec1 open_channel $othernode@localhost 0.15
+./run_electrum --regtest -D /tmp/elec1 open_channel $othernode 0.15
sleep 3
bitcoin-cli generatetoaddress 6 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null
sleep 12
diff --git a/electrum/tests/test_lnwatcher/redeem_htlcs.sh b/electrum/tests/test_lnwatcher/redeem_htlcs.sh
@@ -5,7 +5,7 @@ bitcoin-cli generatetoaddress 100 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s >
sleep 30
balance_before=$(./run_electrum --regtest -D /tmp/elec1 getbalance | jq -r .confirmed)
othernode=$(./run_electrum --regtest -D /tmp/elec2 nodeid)
-./run_electrum --regtest -D /tmp/elec1 open_channel $othernode@localhost 0.15
+./run_electrum --regtest -D /tmp/elec1 open_channel $othernode 0.15
sleep 12
bitcoin-cli generatetoaddress 6 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s > /dev/null
sleep 12
@@ -22,8 +22,8 @@ done
screen -S elec2 -X quit
sleep 1
ps ax | grep run_electrum
-chan_id=$(python3 run_electrum -D /tmp/elec1 --regtest listchannels | jq -r ".[0].channel_point" | cut -d: -f1)
-./run_electrum -D /tmp/elec1 --regtest closechannel $chan_id --force
+chan_id=$(python3 run_electrum -D /tmp/elec1 --regtest list_channels | jq -r ".[0].channel_point")
+./run_electrum -D /tmp/elec1 --regtest close_channel $chan_id --force
sleep 12
bitcoin-cli generatetoaddress 144 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s
sleep 30