lnchannel.available_to_spend: LOCAL now respects "fee spike buffer"
This commit is contained in:
@@ -622,7 +622,7 @@ class TestChannel(ElectrumTestCase):
|
||||
class TestAvailableToSpend(ElectrumTestCase):
|
||||
def test_DesyncHTLCs(self):
|
||||
alice_channel, bob_channel = create_test_channels()
|
||||
self.assertEqual(499994624000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(499986152000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(500000000000, bob_channel.available_to_spend(LOCAL))
|
||||
|
||||
paymentPreimage = b"\x01" * 32
|
||||
@@ -636,13 +636,13 @@ class TestAvailableToSpend(ElectrumTestCase):
|
||||
|
||||
alice_idx = alice_channel.add_htlc(htlc_dict).htlc_id
|
||||
bob_idx = bob_channel.receive_htlc(htlc_dict).htlc_id
|
||||
self.assertEqual(89993592000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(89984088000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(500000000000, bob_channel.available_to_spend(LOCAL))
|
||||
|
||||
force_state_transition(alice_channel, bob_channel)
|
||||
bob_channel.fail_htlc(bob_idx)
|
||||
alice_channel.receive_fail_htlc(alice_idx, error_bytes=None)
|
||||
self.assertEqual(89993592000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(89984088000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(500000000000, bob_channel.available_to_spend(LOCAL))
|
||||
# Alice now has gotten all her original balance (5 BTC) back, however,
|
||||
# adding a new HTLC at this point SHOULD fail, since if she adds the
|
||||
@@ -662,7 +662,7 @@ class TestAvailableToSpend(ElectrumTestCase):
|
||||
# Now do a state transition, which will ACK the FailHTLC, making Alice
|
||||
# able to add the new HTLC.
|
||||
force_state_transition(alice_channel, bob_channel)
|
||||
self.assertEqual(499994624000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(499986152000, alice_channel.available_to_spend(LOCAL))
|
||||
self.assertEqual(500000000000, bob_channel.available_to_spend(LOCAL))
|
||||
alice_channel.add_htlc(htlc_dict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user