-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simple cross-chain hub demo #46
Conversation
67d40ea
to
10b175b
Compare
async fn create_invoices_client( | ||
&self, | ||
) -> Result<InvoicesClient, lnd_grpc_tonic_client::channel::Error> { | ||
create_invoices_client( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we need to create a new gRPC client for each tlc settled. It would be better if we can somehow reuse the same connection. I don't know if tonic can automatically do that for us. This is not an urgent or important feature for now. But I think we can document that.
|
||
let mut client = state.lnd_connection.create_router_client().await?; | ||
// TODO: set a fee | ||
let mut stream = client.send_payment_v2(req).await?.into_inner(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will block the actor from processing other messages while issuing gRPC request. I think we can spawn a subtask and make this non-blocking. The problem is that after received gRPC response, we need to update the state. We can do that by add a message to the cch actor which can then process state update by handling this message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is aync. Awaiting on a inner future will not block the actor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async function means that this code snippet will not block current thread, but this will still make the actor unable to process any other messages unrelated to this one, e.g. other SendBtc messages. This is because the function handle of this actor has still not returned, thus we have no chance to handle any other messages queued in the mailbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is a little bit centered at BTC<->wBTC (an xDUT token with 1-1 pegging to BTC). I am wondering how easy it is to tweak code in this PR to support other assets. To be clear, we currently are only interested in BTC<->wBTC exchange. But the code can be make more generic.
0fa868e
to
6434c53
Compare
The code base before this PR supports CKB <-> BTC by configuring a ratio. A similar change can be applied to support other xUDT. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
Blocking, see #123 |
1cdea9b
to
821a3df
Compare
Specification: #85
Future Works: #88