-
Notifications
You must be signed in to change notification settings - Fork 123
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
accounts: improved utxosToAccount #2944
Conversation
selecting inputs from to address if own address and only one target
Thanks @kuegi. This is a neat low hanging fruit find. Let's see if @Bushstar has any thoughts on this. It does create an ad-hoc branch, perhaps we can merge it into fund by merging it into the coin select strategy if we can apply this to many other places safely (and passing down the target as hints) |
If it's too much effort to reuse, this looks good to merge to me.
|
honestly no idea what an ad-hoc branch is in this context. Was thinking about adapting basically all other places require an auth-input from the "owner" of the customTx which makes it use one utxo from there and also forces the change address. AFAIK |
I ran |
with clang-format installed, fmt gives me a lot of additional changes: |
true, I got version 18 installed. need to find a way to install 15 (homebrew only has 8 and 11)... |
not used in this rpc right now
./make.sh fmt should use the right config automatically, so odd if it resulted in a different output. Possibly either an overenthusiastic editor formatted with different config or may be a different version of clang fmt that made different assumptions.
There are a bunch of clang format configs. Unfortunate inheritance from Bitcoin. They also never seem to have applied the configs properly, so the codebase isn't coherent and we can't reformat these as well as is makes merging or patching from upstream impossible after reformatting. What we do to find middle ground is we enforce our config for everything under the |
The specific ruleset we do is here: https://github.com/DeFiCh/ain/blob/master/make.sh/#L489-L519
|
Edit: Please ignore. Local error.
|
anyway, I added tests for the behaviour: #2963 |
Summary
when you create a utxostoaccount message, the wallet selects "random" utxos to use. Most of the time such a tx is used to transfer utxos from the address to the token layer of the same address. The random selection therefore just messes with the accounting (pull utxos from other addresses in the wallet).
This PR changes that: if there is only 1 target address, and the target address is owned by the account, only utxos of that address are used (if enough are available)
RPCs
changes in input selection of
utxostoaccount
Implications
Storage
Consensus