electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 4dc6c6c82edbeb86357d55b507d4345b638757f8
parent 8d77a7ecd86fb39c1fb21a506144ba23dcabb83a
Author: ThomasV <thomasv@electrum.org>
Date:   Thu,  7 Mar 2019 18:21:39 +0100

fix tests (follow up prev commit)

Diffstat:
Melectrum/tests/test_lnchannel.py | 6++++++
Melectrum/tests/test_lnpeer.py | 7+++----
Melectrum/tests/test_lnutil.py | 2+-
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/electrum/tests/test_lnchannel.py b/electrum/tests/test_lnchannel.py @@ -201,6 +201,7 @@ class TestChannel(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : one_bitcoin_in_msat, 'cltv_expiry' : 5, + 'timestamp' : 0, } # First Alice adds the outgoing HTLC to her local channel's state @@ -604,6 +605,7 @@ class TestAvailableToSpend(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : int(4.1 * one_bitcoin_in_msat), 'cltv_expiry' : 5, + 'timestamp' : 0, } alice_idx = alice_channel.add_htlc(htlc_dict).htlc_id @@ -622,6 +624,7 @@ class TestAvailableToSpend(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : one_bitcoin_in_msat, 'cltv_expiry' : 5, + 'timestamp' : 0, } with self.assertRaises(lnutil.PaymentFailure): alice_channel.add_htlc(htlc_dict) @@ -669,6 +672,7 @@ class TestChanReserve(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : int(.5 * one_bitcoin_in_msat), 'cltv_expiry' : 5, + 'timestamp' : 0, } self.alice_channel.add_htlc(htlc_dict) self.bob_channel.receive_htlc(htlc_dict) @@ -729,6 +733,7 @@ class TestChanReserve(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : int(2 * one_bitcoin_in_msat), 'cltv_expiry' : 5, + 'timestamp' : 0, } alice_idx = self.alice_channel.add_htlc(htlc_dict).htlc_id bob_idx = self.bob_channel.receive_htlc(htlc_dict).htlc_id @@ -773,6 +778,7 @@ class TestDust(unittest.TestCase): 'payment_hash' : paymentHash, 'amount_msat' : 1000 * htlcAmt, 'cltv_expiry' : 5, # also in create_test_channels + 'timestamp' : 0, } old_values = [x.value for x in bob_channel.current_commitment(LOCAL).outputs() ] diff --git a/electrum/tests/test_lnpeer.py b/electrum/tests/test_lnpeer.py @@ -109,12 +109,11 @@ class MockLNWorker: def on_channels_updated(self): pass - def save_invoice(*args): + def save_invoice(*args, is_paid=False): pass get_invoice = LNWorker.get_invoice get_preimage = LNWorker.get_preimage - get_preimage_and_timestamp = LNWorker.get_preimage_and_timestamp _create_route_from_invoice = LNWorker._create_route_from_invoice _check_invoice = staticmethod(LNWorker._check_invoice) _pay_to_route = LNWorker._pay_to_route @@ -216,8 +215,8 @@ class TestPeer(SequentialTestCase): ('d', 'coffee') ]) pay_req = lnencode(addr, w2.node_keypair.privkey) - w2.preimages[bh2u(RHASH)] = (bh2u(payment_preimage), 0) - w2.invoices[bh2u(RHASH)] = (pay_req, True) + w2.preimages[bh2u(RHASH)] = bh2u(payment_preimage) + w2.invoices[bh2u(RHASH)] = (pay_req, True, False) return pay_req @staticmethod diff --git a/electrum/tests/test_lnutil.py b/electrum/tests/test_lnutil.py @@ -495,7 +495,7 @@ class TestLNUtil(unittest.TestCase): (1, 2000 * 1000), (3, 3000 * 1000), (4, 4000 * 1000)]: - htlc_obj[num] = UpdateAddHtlc(amount_msat=msat, payment_hash=bitcoin.sha256(htlc_payment_preimage[num]), cltv_expiry=None, htlc_id=None) + htlc_obj[num] = UpdateAddHtlc(amount_msat=msat, payment_hash=bitcoin.sha256(htlc_payment_preimage[num]), cltv_expiry=None, htlc_id=None, timestamp=0) htlcs = [ScriptHtlc(htlc[x], htlc_obj[x]) for x in range(5)] our_commit_tx = make_commitment(