Browse Source

lnhtlc: (trivial) rename method

patch-4
SomberNight 4 years ago
parent
commit
05e58671c9
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/lnhtlc.py
  2. 4
      electrum/lnpeer.py

8
electrum/lnhtlc.py

@ -320,7 +320,7 @@ class HTLCManager:
return False
@with_lock
def is_add_htlc_irrevocably_committed_yet(
def is_htlc_irrevocably_added_yet(
self,
*,
ctx_owner: HTLCOwner = None,
@ -330,9 +330,9 @@ class HTLCManager:
"""Returns whether `add_htlc` was irrevocably committed to `ctx_owner's` ctx.
If `ctx_owner` is None, both parties' ctxs are checked.
"""
in_local = self._is_add_htlc_irrevocably_committed_yet(
in_local = self._is_htlc_irrevocably_added_yet(
ctx_owner=LOCAL, htlc_proposer=htlc_proposer, htlc_id=htlc_id)
in_remote = self._is_add_htlc_irrevocably_committed_yet(
in_remote = self._is_htlc_irrevocably_added_yet(
ctx_owner=REMOTE, htlc_proposer=htlc_proposer, htlc_id=htlc_id)
if ctx_owner is None:
return in_local and in_remote
@ -344,7 +344,7 @@ class HTLCManager:
raise Exception(f"unexpected ctx_owner: {ctx_owner!r}")
@with_lock
def _is_add_htlc_irrevocably_committed_yet(
def _is_htlc_irrevocably_added_yet(
self,
*,
ctx_owner: HTLCOwner,

4
electrum/lnpeer.py

@ -1574,7 +1574,7 @@ class Peer(Logger):
def fulfill_htlc(self, chan: Channel, htlc_id: int, preimage: bytes):
self.logger.info(f"_fulfill_htlc. chan {chan.short_channel_id}. htlc_id {htlc_id}")
assert chan.can_send_ctx_updates(), f"cannot send updates: {chan.short_channel_id}"
assert chan.hm.is_add_htlc_irrevocably_committed_yet(htlc_proposer=REMOTE, htlc_id=htlc_id)
assert chan.hm.is_htlc_irrevocably_added_yet(htlc_proposer=REMOTE, htlc_id=htlc_id)
chan.settle_htlc(preimage, htlc_id)
self.send_message(
"update_fulfill_htlc",
@ -1809,7 +1809,7 @@ class Peer(Logger):
done = set()
unfulfilled = chan.hm.log.get('unfulfilled_htlcs', {})
for htlc_id, (local_ctn, remote_ctn, onion_packet_hex, forwarding_info) in unfulfilled.items():
if not chan.hm.is_add_htlc_irrevocably_committed_yet(htlc_proposer=REMOTE, htlc_id=htlc_id):
if not chan.hm.is_htlc_irrevocably_added_yet(htlc_proposer=REMOTE, htlc_id=htlc_id):
continue
htlc = chan.hm.get_htlc_by_id(REMOTE, htlc_id)
error_reason = None # type: Optional[OnionRoutingFailure]

Loading…
Cancel
Save