Browse Source

follow-up prev commit

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
3430d1aaa3
  1. 14
      electrum/lnchan.py
  2. 8
      electrum/tests/test_lnchan.py

14
electrum/lnchan.py

@ -377,7 +377,7 @@ class Channel(PrintError):
current_commitment_signature=sig,
current_htlc_signatures=htlc_sigs_string)
if self.pending_fee:
if self.pending_fee is not None:
if not self.constraints.is_initiator:
self.pending_fee[FUNDEE_SIGNED] = True
if self.constraints.is_initiator and self.pending_fee[FUNDEE_ACKED]:
@ -403,7 +403,7 @@ class Channel(PrintError):
new_feerate = self.constraints.feerate
if self.pending_fee:
if self.pending_fee is not None:
if not self.constraints.is_initiator and self.pending_fee[FUNDEE_SIGNED]:
new_feerate = self.pending_fee.rate
self.pending_fee = None
@ -477,10 +477,10 @@ class Channel(PrintError):
self.log = old_logs
raise Exception('revoked secret not for current point')
if self.pending_fee:
if self.pending_fee is not None:
if not self.constraints.is_initiator:
self.pending_fee[FUNDEE_SIGNED] = True
if self.constraints.is_initiator and pending_fee[FUNDEE_ACKED]:
if self.constraints.is_initiator and self.pending_fee[FUNDEE_ACKED]:
self.pending_fee[FUNDER_SIGNED] = True
# FIXME not sure this is correct... but it seems to work
@ -527,7 +527,7 @@ class Channel(PrintError):
amount_msat = self.config[LOCAL].amount_msat + (received_this_batch - sent_this_batch)
)
if self.pending_fee:
if self.pending_fee is not None:
if self.constraints.is_initiator:
self.pending_fee[FUNDEE_ACKED] = True
@ -608,7 +608,7 @@ class Channel(PrintError):
def pending_feerate(self, subject):
candidate = self.constraints.feerate
if self.pending_fee:
if self.pending_fee is not None:
x = self.pending_fee.pending_feerate(subject)
if x is not None:
candidate = x
@ -684,7 +684,7 @@ class Channel(PrintError):
def update_fee(self, feerate, initiator):
if self.constraints.is_initiator != initiator:
raise Exception("Cannot update_fee: wrong initiator", initiator)
if self.pending_fee:
if self.pending_fee is not None:
raise Exception("a fee update is already in progress")
self.pending_fee = FeeUpdate(self, rate=feerate)

8
electrum/tests/test_lnchan.py

@ -317,8 +317,8 @@ class TestChannel(unittest.TestCase):
#self.assertEqual(alice_channel.remote_update_log, [], "alice's remote not updated, should be empty, has %s entries instead"% len(alice_channel.remote_update_log))
self.assertEqual(self.bob_pending_remote_balance, self.alice_channel.balance(LOCAL))
alice_channel.update_fee(100000)
bob_channel.receive_update_fee(100000)
alice_channel.update_fee(100000, True)
bob_channel.update_fee(100000, False)
force_state_transition(alice_channel, bob_channel)
self.htlc_dict['amount_msat'] *= 5
@ -337,8 +337,8 @@ class TestChannel(unittest.TestCase):
def alice_to_bob_fee_update(self, fee=111):
self.alice_channel.update_fee(fee)
self.bob_channel.receive_update_fee(fee)
self.alice_channel.update_fee(fee, True)
self.bob_channel.update_fee(fee, False)
return fee
def test_UpdateFeeSenderCommits(self):

Loading…
Cancel
Save