Browse Source

Fix broken sendmany RPC

The sendmany RPC was broken in the 3.3.0 release due to a bad merge of upstream KMD code,
resulting in this kind of error:

./src/hush-cli sendmany "" "{\"$TADDR1\": 0.0001, \"$TADDR2\": 0.0002, \"$TADDR3\": 0.0004}"
error code: -3
error message:
Amount is not a number or string

No matter how many recipients you give, it will always "fall off the end" of the array, because it increments i twice per loop.
That means AmountFromValue(sendTo[i]) is given an invalid amount and the RPC errors out, with no loss of funds.

This is not a consensus bug and only nodes who want to use the sendmany RPC need to upgrade.
Since GUI wallets do not use this RPC, it's most likely pools and exchanges that would want this.
pull/80/head
Duke Leto 4 years ago
parent
commit
8eef38f94c
  1. 1
      src/wallet/rpcwallet.cpp

1
src/wallet/rpcwallet.cpp

@ -1529,7 +1529,6 @@ UniValue sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
CRecipient recipient = {scriptPubKey, nAmount, fSubtractFeeFromAmount};
vecSend.push_back(recipient);
i++;
}
EnsureWalletIsUnlocked();

Loading…
Cancel
Save