Skip to content

Conversation

@doitian
Copy link
Member

@doitian doitian commented Sep 15, 2025

Based on #615

A rework of #522

The PR can be reviewed by commits:

  • The first commit refactor the code to use a uniform order data structure.
  • The second commit stores orders in rocksdb
  • The last commit loads orders from database on restart and purge finished orders after 14 days.

Add StoreWithPubSub to emit store update events. It uses ractor
OutputPort for pub-sub.

This is a rework of StoreWithHooks in nervosnetwork#511

- Use decorator pattern to add additional features on Store
- Minimize the interface change that original codes relying on Store
  traits dot not need to change.
- Avoid using an Actor to fetch extra data asynchronously. This resolves
  the issue mentioned in
  nervosnetwork#615 (comment)
  . The channel actor cleans preimage on success payment automatically.
  Thus we may fail to get the preimage when settling the cch payment in
  the BTC end.
@doitian doitian force-pushed the feature/cch-persistence branch from dbb0121 to f7b27ae Compare September 17, 2025 06:43
Merge SendBTCOrder and ReceiveBTCOrder into CchOrder to simplify
persistence.

Add a order status to mark that the outgoing payment succeeds and
preimage is obtained. Ensure the preimage is stored in case to retry
settling the incoming payment.
Load orders from database and resume the workflow.
@doitian doitian force-pushed the feature/cch-persistence branch from f7b27ae to ac35142 Compare September 17, 2025 06:48
@doitian doitian marked this pull request as draft November 3, 2025 02:38
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.

1 participant