Skip to content

Conversation

@panleone
Copy link

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)

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a 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.

@Fuzzbawls
Copy link
Collaborator

Also, since you're removing a deprecated RPC command, you'll need to modify test/functional/rpc_deprecated.py to remove the assertion/reference to said command still being available via a startup override.

@panleone
Copy link
Author

panleone commented Mar 4, 2023

Updated on master

@Fuzzbawls
Copy link
Collaborator

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 master branch changes to a PR, use git pull --rebase origin master instead.

@Fuzzbawls Fuzzbawls added this to the 6.0.0 milestone Mar 5, 2023
@Fuzzbawls Fuzzbawls changed the title Fixing AutoCombineDust and improving setautocombinethreshold [Wallet] Fix AutoCombineDust and improve setautocombinethreshold Mar 5, 2023
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 63488be

Copy link
Member

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 63488be

@Fuzzbawls Fuzzbawls merged commit ac8a74d into PIVX-Project:master Mar 8, 2023
@Fuzzbawls Fuzzbawls modified the milestones: 6.0.0, 5.6.0 Feb 6, 2024
@panleone panleone deleted the collectdustbug branch April 8, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants