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

Improve spend txn handling #1

Open
AliAshrafD opened this issue Apr 24, 2021 · 3 comments
Open

Improve spend txn handling #1

AliAshrafD opened this issue Apr 24, 2021 · 3 comments

Comments

@AliAshrafD
Copy link

Currently, the wallet pre-empts the total balance by including all UTXOs in the transaction no matter what the actual output amount may be. In the case of wallets with multiple tiny inputs this approach results in giant transactions even when the owner is spending a fraction of the balance.

@AliAshrafD
Copy link
Author

AliAshrafD commented Apr 25, 2021

I made a pull request for fixing this. The idea is spending utxos with smaller amounts in the first few transactions. For this to happen we sort the unspent array first (ascending ordered by amount), then we spend the minimum required number of the topmost items as the inputs to the txn under construction. It is also possible to sort the array in reverse order (descending) using the largets outputs first, it would reduce the number of inputs for the first txns, but leaves more dusts in the database.
By the way, is this a dead project?

@AliAshrafD
Copy link
Author

For now, I commented-out the sort part because of performance issues.

@AliAshrafD
Copy link
Author

Just tested the wallet with this patch, it works fine, I managed to spend 1000 utxos gradually 70-80 each time. Good news, I believe.

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

No branches or pull requests

1 participant