Browse Source

fix tests

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
8e753f998a
  1. 4
      electrum/lnbase.py
  2. 5
      electrum/tests/test_lntransport.py
  3. 2
      electrum/tests/test_lnwatcher/breach.sh
  4. 6
      electrum/tests/test_lnwatcher/redeem_htlcs.sh

4
electrum/lnbase.py

@ -30,10 +30,10 @@ from .lnchan import Channel, RevokeAndAck, htlcsum
from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc, from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc,
RemoteConfig, OnlyPubkeyKeypair, ChannelConstraints, RevocationStore, RemoteConfig, OnlyPubkeyKeypair, ChannelConstraints, RevocationStore,
funding_output_script, get_per_commitment_secret_from_seed, 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, LOCAL, REMOTE, HTLCOwner, generate_keypair, LnKeyFamily,
get_ln_flag_pair_of_bit, privkey_to_pubkey, UnknownPaymentHash, MIN_FINAL_CLTV_EXPIRY_ACCEPTED, 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, MINIMUM_MAX_HTLC_VALUE_IN_FLIGHT_ACCEPTED, MAXIMUM_HTLC_MINIMUM_MSAT_ACCEPTED,
MAXIMUM_REMOTE_TO_SELF_DELAY_ACCEPTED) MAXIMUM_REMOTE_TO_SELF_DELAY_ACCEPTED)
from .lntransport import LNTransport, LNTransportBase from .lntransport import LNTransport, LNTransportBase

5
electrum/tests/test_lntransport.py

@ -1,5 +1,6 @@
from electrum.ecc import ECPrivkey from electrum.ecc import ECPrivkey
import asyncio import asyncio
from electrum.lnutil import LNPeerAddr
from electrum.lntransport import LNResponderTransport, LNTransport from electrum.lntransport import LNResponderTransport, LNTransport
from unittest import TestCase 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)) server_future = asyncio.ensure_future(asyncio.start_server(cb, '127.0.0.1', 42898))
l.run_until_complete(server_future) l.run_until_complete(server_future)
async def connect(): async def connect():
reader, writer = await asyncio.open_connection('127.0.0.1', 42898) peer_addr = LNPeerAddr('127.0.0.1', 42898, responder_key.get_public_key_bytes())
t = LNTransport(initiator_key.get_secret_bytes(), responder_key.get_public_key_bytes(), reader, writer) t = LNTransport(initiator_key.get_secret_bytes(), peer_addr)
await t.handshake() await t.handshake()
t.send_bytes(b'hello from client') t.send_bytes(b'hello from client')
self.assertEqual(await t.read_messages().__anext__(), b'hello from server') self.assertEqual(await t.read_messages().__anext__(), b'hello from server')

2
electrum/tests/test_lnwatcher/breach.sh

@ -4,7 +4,7 @@ set -eux pipefail
bitcoin-cli generatetoaddress 109 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null bitcoin-cli generatetoaddress 109 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null
sleep 30 sleep 30
othernode=$(./run_electrum --regtest -D /tmp/elec2 nodeid) 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 sleep 3
bitcoin-cli generatetoaddress 6 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null bitcoin-cli generatetoaddress 6 mwLZSJ2hUkvFoSkyadNGgmu9977w6K8wfj > /dev/null
sleep 12 sleep 12

6
electrum/tests/test_lnwatcher/redeem_htlcs.sh

@ -5,7 +5,7 @@ bitcoin-cli generatetoaddress 100 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s >
sleep 30 sleep 30
balance_before=$(./run_electrum --regtest -D /tmp/elec1 getbalance | jq -r .confirmed) balance_before=$(./run_electrum --regtest -D /tmp/elec1 getbalance | jq -r .confirmed)
othernode=$(./run_electrum --regtest -D /tmp/elec2 nodeid) 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 sleep 12
bitcoin-cli generatetoaddress 6 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s > /dev/null bitcoin-cli generatetoaddress 6 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s > /dev/null
sleep 12 sleep 12
@ -22,8 +22,8 @@ done
screen -S elec2 -X quit screen -S elec2 -X quit
sleep 1 sleep 1
ps ax | grep run_electrum ps ax | grep run_electrum
chan_id=$(python3 run_electrum -D /tmp/elec1 --regtest listchannels | jq -r ".[0].channel_point" | cut -d: -f1) chan_id=$(python3 run_electrum -D /tmp/elec1 --regtest list_channels | jq -r ".[0].channel_point")
./run_electrum -D /tmp/elec1 --regtest closechannel $chan_id --force ./run_electrum -D /tmp/elec1 --regtest close_channel $chan_id --force
sleep 12 sleep 12
bitcoin-cli generatetoaddress 144 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s bitcoin-cli generatetoaddress 144 bcrt1qxcjufgh2jarkp2qkx68azh08w9v5gah8u6es8s
sleep 30 sleep 30

Loading…
Cancel
Save