def htlc_fulfilled(self, chan, payment_hash: bytes, htlc_id: int):
    util.trigger_callback('htlc_fulfilled', payment_hash, chan.channel_id)
    q = self.sent_htlcs.get(payment_hash)
    if q:
        (route, payment_secret, amount_msat, bucket_msat, amount_receiver_msat) = self.sent_htlcs_routes[(payment_hash, chan.short_channel_id, htlc_id)]
        htlc_log = HtlcLog(success=True, route=route, amount_msat=amount_receiver_msat)
        q.put_nowait(htlc_log)
    else:
        key = payment_hash.hex()
        self.set_invoice_status(key, PR_PAID)
        util.trigger_callback('payment_succeeded', self.wallet, key)
def htlc_fulfilled(self, chan, payment_hash: bytes, htlc_id: int):
    util.trigger_callback('htlc_fulfilled', payment_hash, chan.channel_id)
    q = self.sent_htlcs.get(payment_hash)
    if q:
        (route, payment_secret, amount_msat, bucket_msat, amount_receiver_msat) = self.sent_htlcs_routes[(payment_hash, chan.short_channel_id, htlc_id)]
        htlc_log = HtlcLog(success=True, route=route, amount_msat=amount_receiver_msat)
        q.put_nowait(htlc_log)
    else:
        key = payment_hash.hex()
        self.set_invoice_status(key, PR_PAID)
        util.trigger_callback('payment_succeeded', self.wallet, key)