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
Add support for dependent transfers #1253
Conversation
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's a step in the right direction but we still need to refine it so that it helps with real issues like not being able to send multiple txs at once because our wallet owns only 1 coin.
For reference: https://github.com/FuelLabs/faucet/blob/35e7e12963b4259aa97577f3d2e0e88fea36b8b8/src/routes.rs#L206
the faucet has it's own makeshift implementation of dependant transactions to cover for this problem.
let remaining_amount = available_amount - used_base_amount - transaction_fee.max_fee(); | ||
|
||
if remaining_amount == 0 { | ||
return Err(error!( |
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 is a low level problem that we reveal to a high level API call.
The user is not explicitly aware that inputs are being chopped up to make this work under the hood.
If I used dependent_transfers
and this error were to come up, It's not obvious how to fix it.
Also, I doubt there is a way to fix it. If the selected coin(s) fit so perfectly that they can't be split up I either have more coins to cover for the next tx or I don't, it's not a matter dependant transfers.
Maybe we should attempt to execute dependant txs on a best effort basis but not be explicit about it.
.await?; | ||
} | ||
|
||
let tx_status = provider.send_transaction_and_await_commit(tx).await?; |
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.
If we wait for each tx to be finalized there is no need to keep track of the output of previous tx. We can just ask the node to provide spendable coins at that point.
Close #1194.
Checklist