def check_received_mpp_htlc(self, payment_secret, short_channel_id, htlc: UpdateAddHtlc, expected_msat: int) -> Optional[bool]:
    ' return MPP status: True (accepted), False (expired) or None '
    payment_hash = htlc.payment_hash
    (is_expired, is_accepted, htlc_set) = self.received_mpp_htlcs.get(payment_secret, (False, False, set()))
    if (self.get_payment_status(payment_hash) == PR_PAID):
        is_accepted = True
        is_expired = False
    key = (short_channel_id, htlc)
    if (key not in htlc_set):
        htlc_set.add(key)
    if ((not is_accepted) and (not is_expired)):
        total = sum([_htlc.amount_msat for (scid, _htlc) in htlc_set])
        first_timestamp = min([_htlc.timestamp for (scid, _htlc) in htlc_set])
        if self.stopping_soon:
            is_expired = True
        elif ((time.time() - first_timestamp) > self.MPP_EXPIRY):
            is_expired = True
        elif (total == expected_msat):
            is_accepted = True
    if (is_accepted or is_expired):
        htlc_set.remove(key)
    if (len(htlc_set) > 0):
        self.received_mpp_htlcs[payment_secret] = (is_expired, is_accepted, htlc_set)
    elif (payment_secret in self.received_mpp_htlcs):
        self.received_mpp_htlcs.pop(payment_secret)
    return (True if is_accepted else (False if is_expired else None))
return MPP status: True (accepted), False (expired) or None
def check_received_mpp_htlc(self, payment_secret, short_channel_id, htlc: UpdateAddHtlc, expected_msat: int) -> Optional[bool]:
    '  '
    payment_hash = htlc.payment_hash
    (is_expired, is_accepted, htlc_set) = self.received_mpp_htlcs.get(payment_secret, (False, False, set()))
    if (self.get_payment_status(payment_hash) == PR_PAID):
        is_accepted = True
        is_expired = False
    key = (short_channel_id, htlc)
    if (key not in htlc_set):
        htlc_set.add(key)
    if ((not is_accepted) and (not is_expired)):
        total = sum([_htlc.amount_msat for (scid, _htlc) in htlc_set])
        first_timestamp = min([_htlc.timestamp for (scid, _htlc) in htlc_set])
        if self.stopping_soon:
            is_expired = True
        elif ((time.time() - first_timestamp) > self.MPP_EXPIRY):
            is_expired = True
        elif (total == expected_msat):
            is_accepted = True
    if (is_accepted or is_expired):
        htlc_set.remove(key)
    if (len(htlc_set) > 0):
        self.received_mpp_htlcs[payment_secret] = (is_expired, is_accepted, htlc_set)
    elif (payment_secret in self.received_mpp_htlcs):
        self.received_mpp_htlcs.pop(payment_secret)
    return (True if is_accepted else (False if is_expired else None))