Browse Source

fix tests (follow up prev commit)

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
4dc6c6c82e
  1. 6
      electrum/tests/test_lnchannel.py
  2. 7
      electrum/tests/test_lnpeer.py
  3. 2
      electrum/tests/test_lnutil.py

6
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() ]

7
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

2
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(

Loading…
Cancel
Save