electrum

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

commit 3430d1aaa3238e51ea514a4f0c11b9f61b5b2e52
parent 5422de90a2e3f0840fe8604a03eca3bfef29ba63
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 12 Nov 2018 12:25:21 +0100

follow-up prev commit

Diffstat:
Melectrum/lnchan.py | 14+++++++-------
Melectrum/tests/test_lnchan.py | 8++++----
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/electrum/lnchan.py b/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) diff --git a/electrum/tests/test_lnchan.py b/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):