-
Notifications
You must be signed in to change notification settings - Fork 725
[Wallet] Fix AutoCombineDust and improve setautocombinethreshold #2812
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
Conversation
Fuzzbawls
left a comment
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.
Haven't tested functionality yet, but wanted to point out that it seems that the intentional arbitrary whitespace of the CRPCCommand table in rpcwallet.cpp has gotten mangled in this PR.
|
Also, since you're removing a deprecated RPC command, you'll need to modify |
e2e41da to
c8ecedf
Compare
|
Updated on master |
06ca029 to
63488be
Compare
|
I've tidied this up to remove fixup type commits as well as the merge commit. Avoid including merge commits in PRs. If you need to pull in recent |
Fuzzbawls
left a comment
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.
ACK 63488be
Liquid369
left a comment
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.
tACK 63488be
AutoCombineDust has been bugged since an old PR see (#953 #518).
To make an example of what's happening let's consider for simplicity nAutoCombineThreshold = 100 and let's say that the user has 2 UTXOs one of 90 PIVs and the other of 15 PIVs.
With the current code of AutoCombineDust we will therefore try to send a total of 90+15 = 105 PIVs to ourself, more precisely to avoid the "Insufficient funds" the primary output will contain only the 90% =94.5 PIVs and the remaining 10% = 10.5 PIVs is used to pay fees + sent as a change to ourself. As you can see we end up with two new UTXOs, which are still both smaller than the threshold.
This process is iterated block by block until we end up with a single UTXO which is smaller than the threshold, i.e in this example 5 PIVs will be burn in fees.
Moreover the process of "checking all UTXOs at each block for each address of your wallet" can potentially consume a lot of resources especially if the user has a lot of small UTXOs, therefore I added a new parameter "frequency" which will check for dust every N blocks (where N is the value of frequency), and which is set by default at N = 30.
Finally I removed the old autocombinerewards since it is deprecated and was planned to be removed in v6.0 (https://github.com/PIVX-Project/PIVX/blob/master/doc/release-notes.md)