Skip to content
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

The INSUFFICIENT_UTXO error is not clear enough #260

Open
ShookLyngs opened this issue Jul 23, 2024 · 1 comment
Open

The INSUFFICIENT_UTXO error is not clear enough #260

ShookLyngs opened this issue Jul 23, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@ShookLyngs
Copy link
Collaborator

Issue

The reasons triggering the INSUFFICIENT_UTXO error are clear:

  1. Not enough satoshi collected to cover the needs of the outputs and fee
  2. Not enough satoshi collected to generate a change output (change output value < minUtxoSatoshi)

However, it's hard to prompt a specific reason that causes the error because there could be indirect causes:

  1. Small value UTXOs (value < minUtxoSatoshi) of an address will be excluded as they're considered dust
  2. If ckbVirtualResult.needPaymasterCell == true, there's an extra payment to the paymaster
  3. The change output's defined value must be >= minUtxoSatoshi

Possible Resolutions

  • I think this is somewhat a lack-of-documentation issue, and if we can provide a better version of the documentation, things could be easier. For starters, we could write a "Common Errors" section in the documentation, explaining what the errors actually mean in reality and guiding users to find the actual cause or reason for the error.
  • For the indirect cause 3 mentioned above, we could add an option to allow treating the change value as fee if the value is smaller than the minUtxoSatoshi, instead of always generating a change output for that. Related issue: Don't create change output (uneconomical output) if not worthy #183.
@Flouse Flouse added the enhancement New feature or request label Jul 23, 2024
@Flouse
Copy link
Contributor

Flouse commented Jul 23, 2024

  • For the indirect cause 3 mentioned above, we could add an option to allow treating the change value as fee if the value is smaller than the minUtxoSatoshi, instead of always generating a change output for that. Related issue: Don't create change output if not worthy #183.

Ideas about making the BTC tx cost as low as possible

  1. 546 <= changeValue < minUtxoSatoshi
    create the change output directly with changeValue.

  2. changeValue < 546
    The change could be treated as a fee, as it may not be economically viable to create a change output for such a small amount.
    => Don't create change output (uneconomical output) if not worthy #183

@Flouse Flouse added the documentation Improvements or additions to documentation label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants