I had this problem on a NOMP pool recently, I will share how we fixed it. For us, the problem was that a user had used the same address twice, but added some whitespace to their username the second time. So NOMP wouldn't recognize it as a duplicate, but the sendmany command would still fail. The solution for us was to do two things.
- Eliminate the whitespace from workers' names. This commit shows how to do that.
- Combine payouts together when there is more than one worker with the same address. The code for that is shown below.
In paymentProcessor.js, change
var address = worker.address = (worker.address || getProperAddress(w));
worker.sent = addressAmounts[address] = satoshisToCoins(toSend);
to
var address = worker.address = (worker.address || getProperAddress(w)).trim();
if (!worker.sent) {
worker.sent = 0;
}
worker.sent += satoshisToCoins(toSend);
if (!(address in addressAmounts)) {
addressAmounts[address] = 0;
}
addressAmounts[address] += satoshisToCoins(toSend);
If you want to know more about what caused this, the problem here is just what was explained in the error: there are duplicate addresses in the JSON object.
For example, I generated a new address of my own (1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy) and ran:
./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01, "1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'
And the error was:
Invalid parameter, duplicated address: 1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy (code -8)
To fix this problem, you either need to (1) add up all the amounts and pay to the address in one go, or (2) do separate RPC sendmany RPC calls, making sure to not have any duplicates.
In my case, (1) would look like:
./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.02}'
And (2) would look like:
./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'
./bitcoin-cli sendmany "" '{"1PSXKQdR5nG8T5ueG76RaWwhdwqv9JJWzy":0.01}'
You are probably posting the same address twice. Please take an RPC capture, so one can see what you are posting on the server. – Mikko Ohtamaa – 2014-12-15T14:27:01.527
I know, this is a NOMP pool and there is a user that has two workers with the same address. How can I fix this? Is there a way to ignore this and submit the payments? – cmilian – 2014-12-15T14:29:03.647
Count outgoing sums of every address together before doing
sendmany. – Mikko Ohtamaa – 2014-12-15T14:29:56.937Is there PM in this site? – cmilian – 2014-12-15T14:33:29.760
Count outgoing sums of every address together before doing sendmany... Not sure how to do this. – cmilian – 2014-12-15T14:36:48.470
Is there a way to limit or control the amount of payments sendmany groups at a time? This may help me in these payouts while duplicate address removed. – cmilian – 2014-12-15T14:54:48.113
@cmilian We don't know what your question is about now. Who or what is issuing these commands? – David Schwartz – 2014-12-15T15:44:50.740
I a running a NOMP mining pool that has payment job breaking because there are two same wallet address payments in the same sendmany job.
I need to limit amount sent to minimize chance of having the payment in the same transaction for a while until I get rid of this so that the payments go thru. – cmilian – 2014-12-15T16:00:11.907
@DavidSchwartz I a running a NOMP mining pool that has payment job breaking because there are two same wallet address payments in the same sendmany job. I need to limit amount sent to minimize chance of having the payment in the same transaction for a while until I get rid of this so that the payments go thru. Or, do something so that this is ignored. rather ignore duplicate wallet addresses. – cmilian – 2014-12-15T16:22:03.580
@cmilian: No, Stack Exchange does not support private messages.
– Nate Eldredge – 2014-12-15T16:53:34.2232So, whatever code implements the "payment job" (i.e. the code that is calling
sendmanyin the first place) should detect when multiple outputs to the same address are requested, and combine them into one. For instance, if you have a payment to address 1abc for BTC 0.1, and another to the same address for BTC 0.2, you should callsendmanyasking for one payment to 1abd for BTC 0.3. – Nate Eldredge – 2014-12-15T16:56:29.853I understand, you are correct, that is the issue. trying to paste code to show.
[link] https://onedrive.live.com/redir?resid=CD88B09A5E2E741E!34171&authkey=!ACs6xjZnKgsjnBU&ithint=file%2ctxt [link]
how can I do that in this code?
Please edit your question to include the relevant code there. – Mikko Ohtamaa – 2014-12-16T10:21:40.737