aboutsummaryrefslogtreecommitdiff
path: root/src/test/rpc_wallet_tests.cpp
diff options
context:
space:
mode:
authorEric Shaw <ericshaw.linux@gmail.com>2014-09-25 18:39:28 -0400
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-02 19:21:46 +0200
commit31d6390fd17803ab9870e239a0c0c4d0a6be5c68 (patch)
tree1c07e8e8639e5dc9f6a0d7eb48fe7f3ac510700b /src/test/rpc_wallet_tests.cpp
parent4b2b78b9f2bd339cc4505996258e00c186e91792 (diff)
downloadbitcoin-31d6390fd17803ab9870e239a0c0c4d0a6be5c68.tar.xz
Fixed setaccount accepting foreign address
Fixed issue #4209 where using setaccount with a foreign address causes the address to be added to your receiving addresses.
Diffstat (limited to 'src/test/rpc_wallet_tests.cpp')
-rw-r--r--src/test/rpc_wallet_tests.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp
index 1dc2a3d82f..8c1d2900bc 100644
--- a/src/test/rpc_wallet_tests.cpp
+++ b/src/test/rpc_wallet_tests.cpp
@@ -80,11 +80,15 @@ BOOST_AUTO_TEST_CASE(rpc_wallet)
walletdb.WriteAccount(strAccount, account);
});
-
+ CPubKey setaccountDemoPubkey = pwalletMain->GenerateNewKey();
+ CBitcoinAddress setaccountDemoAddress = CBitcoinAddress(CTxDestination(setaccountDemoPubkey.GetID()));
+
/*********************************
* setaccount
*********************************/
- BOOST_CHECK_NO_THROW(CallRPC("setaccount 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ nullaccount"));
+ BOOST_CHECK_NO_THROW(CallRPC("setaccount " + setaccountDemoAddress.ToString() + " nullaccount"));
+ /* 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ is not owned by the test wallet. */
+ BOOST_CHECK_THROW(CallRPC("setaccount 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ nullaccount"), runtime_error);
BOOST_CHECK_THROW(CallRPC("setaccount"), runtime_error);
/* 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4X (33 chars) is an illegal address (should be 34 chars) */
BOOST_CHECK_THROW(CallRPC("setaccount 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4X nullaccount"), runtime_error);