Browse Source

Merge pull request #102 from MyHush/zsendmany_duplicates

Remove z_sendmany restriction on duplicate addresses
pull/123/head
Duke Leto 6 years ago
committed by GitHub
parent
commit
ceff2ea7bd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      qa/rpc-tests/wallet.py
  2. 9
      src/wallet/rpcwallet.cpp

17
qa/rpc-tests/wallet.py

@ -10,9 +10,12 @@ from test_framework.util import assert_equal, assert_greater_than, \
initialize_chain_clean, start_nodes, start_node, connect_nodes_bi, \
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds
import logging
import time
from decimal import Decimal
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class WalletTest (BitcoinTestFramework):
def setup_chain(self):
@ -291,6 +294,20 @@ class WalletTest (BitcoinTestFramework):
errorString = e.error['message']
assert("Too many outputs, size of raw transaction" in errorString)
###### Test that duplicate receiver addresses are allowed
recipients = []
recipients.append({"address":myzaddr, "amount":amount_per_recipient})
recipients.append({"address":myzaddr, "amount":amount_per_recipient})
try:
myopid = self.nodes[0].z_sendmany(myzaddr, recipients)
assert( myopid )
except JSONRPCException,e:
errorString = e.error['message']
logging.info(errorString)
assert( False )
#####
recipients = []
num_t_recipients = 2000
num_z_recipients = 50

9
src/wallet/rpcwallet.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2017 The Hush developers
// Copyright (c) 2017-2018 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -3407,9 +3407,6 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
if (outputs.size()==0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, amounts array is empty.");
// Keep track of addresses to spot duplicates
set<std::string> setAddress;
// Recipients
std::vector<SendManyRecipient> taddrRecipients;
std::vector<SendManyRecipient> zaddrRecipients;
@ -3439,10 +3436,6 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
}
}
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
setAddress.insert(address);
UniValue memoValue = find_value(o, "memo");
string memo;
if (!memoValue.isNull()) {

Loading…
Cancel
Save