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

-mininput fails to ignore some outputs #311

Open
dooglus opened this issue Jul 28, 2017 · 1 comment
Open

-mininput fails to ignore some outputs #311

dooglus opened this issue Jul 28, 2017 · 1 comment

Comments

@dooglus
Copy link
Collaborator

dooglus commented Jul 28, 2017

I used mininput=0.01 in clam.conf to ignore outputs smaller than 0.01 CLAM, then sent myself a transaction paying me multiple outputs, some larger than 0.01 and some smaller.

When I listunspent, I only see the larger outputs, but when I getbalance I see the sum of all outputs, not only the larger ones.

It seems the solution is to move the threshold test up a level:

diff --git a/src/wallet.h b/src/wallet.h
index 6386b1c..1b98045 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -242,7 +242,7 @@ public:
     int64_t GetDebit(const CTxIn& txin) const;
     bool IsMine(const CTxOut& txout) const
     {
-        return ::IsMine(*this, txout.scriptPubKey);
+        return txout.nValue >= nMinimumInputValue && ::IsMine(*this, txout.scriptPubKey);
     }
     int64_t GetCredit(const CTxOut& txout) const
     {
@@ -260,7 +260,7 @@ public:
     bool IsMine(const CTransaction& tx) const
     {
         BOOST_FOREACH(const CTxOut& txout, tx.vout)
-            if (IsMine(txout) && txout.nValue >= nMinimumInputValue)
+            if (IsMine(txout))
                 return true;
         return false;
     }
@dooglus
Copy link
Collaborator Author

dooglus commented Jul 28, 2017

I sent myself 0.1, 0.01, 0.001, 0.0001 in 4 separate transactions, and then sent myself the same 4 amounts but in a single transaction. So the total I received is 0.2222, but only 0.22 of it is at or above the 0.01 threshold.

I check the unspent outputs, and only see the four outputs that I should see:

$ echo $(clamd listunspent | grep amount | awk '{print $3}' | sort)
0.01000000, 0.01000000, 0.10000000, 0.10000000,

But when I check the balance, I see the sum of 6 outputs, including 2 of the too-small ones:

$ clamd getbalance
0.22110000

After applying the patch in OP, the getbalance gives 0.22 as expected:

$ clamd getbalance
0.22000000

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