Skip to content

[cch] cancel receive payment , will cause pending TLC to get stuck in the channel. #931

@gpBlockchain

Description

@gpBlockchain

commit:b263400

lnd[1]<----> lnd[0]<---->fiber[0]<---->fiber[1]

fiber[1] send btc to lnd[1],but lnd[1] cancel the invoice ,cause pending TLC to get stuck in the fiber channel.

  1. invoice = lnd[1].addinvoice(800)
  2. btc_invoice = fiber1.send_btc(invoice)
  3. lnd[1].cancelinvoice(invoice)
  4. fiber2.send_payment(btc_invoice)
  5. fiber1[0].get_cch_order(btc_invoice)-> return failed
  6. fiber2.get_payment(btc_invoice) -> return Inflight
  7. fiber1.get_invoice(btc_invoice) -> return Received
  8. fiber1.cancel_invoice(btc_invoice) -> succ
  9. fiber1.get_invoice(btc_invoice) -> return canceled
  10. fiber2.get_payment(btc_invoice) -> return Inflight
    pending TLC to get stuck in the channel.
lndInvoice = self.LNDs[1].addinvoice(800)
        send_payment_response = self.fiber1.get_client().send_btc(
            {
                "btc_pay_req": lndInvoice["payment_request"],
                "currency": "Fibd",
            }
        )
        self.LNDs[1].ln_cli_with_cmd(f"cancelinvoice {lndInvoice['r_hash']}")
        payment = self.fiber2.get_client().send_payment({
            "invoice": send_payment_response['incoming_invoice']['Fiber']
        })
        time.sleep(1)
        btc_invoice = self.fiber1.get_client().get_invoice({
            'payment_hash':payment['payment_hash']
        })
        print("btc invoice:",btc_invoice)
        cch_order = self.fiber1.get_client().get_cch_order({"payment_hash": payment["payment_hash"]})
        print("cch order:",cch_order)
        self.fiber1.get_client().cancel_invoice({
            'payment_hash': payment['payment_hash']
        })
        time.sleep(10)
        self.fiber2.get_client().get_payment({
            "payment_hash":payment['payment_hash']
        })

expected:

  1. cancel invoice should be able to roll back the TLC.
  2. when get_cch_order return failed ,the pending TLC will be rolled back automatically.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions