mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 02:35:20 +00:00
follow-up prev commit
This commit is contained in:
parent
5422de90a2
commit
3430d1aaa3
2 changed files with 11 additions and 11 deletions
|
@ -377,7 +377,7 @@ class Channel(PrintError):
|
||||||
current_commitment_signature=sig,
|
current_commitment_signature=sig,
|
||||||
current_htlc_signatures=htlc_sigs_string)
|
current_htlc_signatures=htlc_sigs_string)
|
||||||
|
|
||||||
if self.pending_fee:
|
if self.pending_fee is not None:
|
||||||
if not self.constraints.is_initiator:
|
if not self.constraints.is_initiator:
|
||||||
self.pending_fee[FUNDEE_SIGNED] = True
|
self.pending_fee[FUNDEE_SIGNED] = True
|
||||||
if self.constraints.is_initiator and self.pending_fee[FUNDEE_ACKED]:
|
if self.constraints.is_initiator and self.pending_fee[FUNDEE_ACKED]:
|
||||||
|
@ -403,7 +403,7 @@ class Channel(PrintError):
|
||||||
|
|
||||||
new_feerate = self.constraints.feerate
|
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]:
|
if not self.constraints.is_initiator and self.pending_fee[FUNDEE_SIGNED]:
|
||||||
new_feerate = self.pending_fee.rate
|
new_feerate = self.pending_fee.rate
|
||||||
self.pending_fee = None
|
self.pending_fee = None
|
||||||
|
@ -477,10 +477,10 @@ class Channel(PrintError):
|
||||||
self.log = old_logs
|
self.log = old_logs
|
||||||
raise Exception('revoked secret not for current point')
|
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:
|
if not self.constraints.is_initiator:
|
||||||
self.pending_fee[FUNDEE_SIGNED] = True
|
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
|
self.pending_fee[FUNDER_SIGNED] = True
|
||||||
|
|
||||||
# FIXME not sure this is correct... but it seems to work
|
# 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)
|
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:
|
if self.constraints.is_initiator:
|
||||||
self.pending_fee[FUNDEE_ACKED] = True
|
self.pending_fee[FUNDEE_ACKED] = True
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ class Channel(PrintError):
|
||||||
|
|
||||||
def pending_feerate(self, subject):
|
def pending_feerate(self, subject):
|
||||||
candidate = self.constraints.feerate
|
candidate = self.constraints.feerate
|
||||||
if self.pending_fee:
|
if self.pending_fee is not None:
|
||||||
x = self.pending_fee.pending_feerate(subject)
|
x = self.pending_fee.pending_feerate(subject)
|
||||||
if x is not None:
|
if x is not None:
|
||||||
candidate = x
|
candidate = x
|
||||||
|
@ -684,7 +684,7 @@ class Channel(PrintError):
|
||||||
def update_fee(self, feerate, initiator):
|
def update_fee(self, feerate, initiator):
|
||||||
if self.constraints.is_initiator != initiator:
|
if self.constraints.is_initiator != initiator:
|
||||||
raise Exception("Cannot update_fee: wrong 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")
|
raise Exception("a fee update is already in progress")
|
||||||
self.pending_fee = FeeUpdate(self, rate=feerate)
|
self.pending_fee = FeeUpdate(self, rate=feerate)
|
||||||
|
|
||||||
|
|
|
@ -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(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))
|
self.assertEqual(self.bob_pending_remote_balance, self.alice_channel.balance(LOCAL))
|
||||||
|
|
||||||
alice_channel.update_fee(100000)
|
alice_channel.update_fee(100000, True)
|
||||||
bob_channel.receive_update_fee(100000)
|
bob_channel.update_fee(100000, False)
|
||||||
force_state_transition(alice_channel, bob_channel)
|
force_state_transition(alice_channel, bob_channel)
|
||||||
|
|
||||||
self.htlc_dict['amount_msat'] *= 5
|
self.htlc_dict['amount_msat'] *= 5
|
||||||
|
@ -337,8 +337,8 @@ class TestChannel(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def alice_to_bob_fee_update(self, fee=111):
|
def alice_to_bob_fee_update(self, fee=111):
|
||||||
self.alice_channel.update_fee(fee)
|
self.alice_channel.update_fee(fee, True)
|
||||||
self.bob_channel.receive_update_fee(fee)
|
self.bob_channel.update_fee(fee, False)
|
||||||
return fee
|
return fee
|
||||||
|
|
||||||
def test_UpdateFeeSenderCommits(self):
|
def test_UpdateFeeSenderCommits(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue