1
0

lnworker: rework "is_dangerous"

"Should channel be closed due to expiring htlcs?"
This commit is contained in:
SomberNight
2019-08-14 21:38:02 +02:00
committed by ThomasV
parent ce54b5411e
commit 0973b86925
4 changed files with 63 additions and 17 deletions

View File

@@ -271,6 +271,12 @@ class HTLCManager:
ctn = self.ctn_latest(subject) + 1
return self.htlcs(subject, ctn)
def was_htlc_preimage_released(self, *, htlc_id: int, htlc_sender: HTLCOwner) -> bool:
settles = self.log[htlc_sender]['settles']
if htlc_id not in settles:
return False
return settles[htlc_id][htlc_sender] is not None
def all_settled_htlcs_ever_by_direction(self, subject: HTLCOwner, direction: Direction,
ctn: int = None) -> Sequence[UpdateAddHtlc]:
"""Return the list of all HTLCs that have been ever settled in subject's