Skip to content

Conversation

@doitian
Copy link
Member

@doitian doitian commented Nov 4, 2025

Important

Stack PR based on #945

CCH is added before multi-hop payments so it manipulates TLC directly
for fiber payments.

This PR adds multi-hop payments support to CCH.

Differences with #615 :

  • This PR does not use store change event to monitor fiber payments and invoices. Such change will be included in a new PR.
  • This PR uses HoldTlc instead of a new database type InvoiceChannelInfo to store incoming payments to hold invoices.
  • This PR includes the refactoring in feat: cch persistence #898 to uniform SendBTCOrder and ReceiveBTCOrder into CchOrder.

@doitian doitian force-pushed the cch-with-fiber-payment branch 3 times, most recently from 810eb33 to d616965 Compare November 4, 2025 10:10
@doitian doitian requested a review from Copilot November 4, 2025 15:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the cross-chain hub (CCH) implementation to support bidirectional BTC-CKB swaps using a unified order structure. The changes consolidate the separate SendBTC and ReceiveBTC order types into a single CchOrder type, introduce hold invoice support, and improve the payment flow.

Key Changes

  • Unified order management: Merged SendBTCOrder and ReceiveBTCOrder into a single CchOrder struct with a CchInvoice enum to handle both Lightning and Fiber invoices
  • Added hold invoice support: Introduced settle_invoice RPC method and related error handling to manually settle hold invoices
  • Simplified payment flow: Refactored RPC methods (renamed get_receive_btc_order to get_cch_order) and updated test files to reflect new API

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/fiber-lib/src/cch/order.rs Unified order types into CchOrder and added CchInvoice enum for handling both network types
crates/fiber-lib/src/cch/actor.rs Major refactor of CCH actor implementation with unified order processing and network actor integration
crates/fiber-lib/src/cch/orders_db.rs Simplified database methods to work with unified CchOrder type
crates/fiber-lib/src/rpc/invoice.rs Added settle_invoice RPC method and modified new_invoice to support optional preimage/hash parameters
crates/fiber-lib/src/rpc/cch.rs Updated RPC interfaces to use CchOrderResponse and simplified parameter structures
crates/fiber-lib/src/fiber/network.rs Added AddInvoice and SettleInvoice commands to network actor
crates/fiber-lib/src/fiber/channel.rs Added hold TLC support for invoices without preimages
tests/bruno/e2e/cross-chain-hub/*.bru Updated e2e test suite to reflect new API and workflow
docs/biscuit-auth.md Updated authorization rules for renamed RPC methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@doitian doitian force-pushed the cch-with-fiber-payment branch 4 times, most recently from 4a3306d to 35e4a4e Compare November 5, 2025 01:09
@doitian doitian mentioned this pull request Nov 5, 2025
9 tasks
@doitian doitian force-pushed the cch-with-fiber-payment branch 8 times, most recently from 9fd56b0 to e5772aa Compare November 7, 2025 05:51
CCH is added before multi-hop payments so it manipulates TLC directly
for fiber payments.

This PR adds multi-hop payments support to CCH.
@doitian doitian force-pushed the cch-with-fiber-payment branch from e5772aa to 800dc26 Compare November 10, 2025 07:25
@doitian doitian merged commit e39b267 into nervosnetwork:develop Nov 11, 2025
24 checks passed
@doitian doitian deleted the cch-with-fiber-payment branch November 11, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants