1 // Copyright (c) 2012-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #include "rpc/server.h"
6 #include "rpc/client.h"
11 #include "test/test_bitcoin.h"
13 #include <boost/algorithm/string.hpp>
14 #include <boost/assign/list_of.hpp>
15 #include <boost/test/unit_test.hpp>
19 UniValue
CallRPC(std::string args
)
21 std::vector
<std::string
> vArgs
;
22 boost::split(vArgs
, args
, boost::is_any_of(" \t"));
23 std::string strMethod
= vArgs
[0];
24 vArgs
.erase(vArgs
.begin());
25 JSONRPCRequest request
;
26 request
.strMethod
= strMethod
;
27 request
.params
= RPCConvertValues(strMethod
, vArgs
);
28 request
.fHelp
= false;
29 BOOST_CHECK(tableRPC
[strMethod
]);
30 rpcfn_type method
= tableRPC
[strMethod
]->actor
;
32 UniValue result
= (*method
)(request
);
35 catch (const UniValue
& objError
) {
36 throw std::runtime_error(find_value(objError
, "message").get_str());
41 BOOST_FIXTURE_TEST_SUITE(rpc_tests
, TestingSetup
)
43 BOOST_AUTO_TEST_CASE(rpc_rawparams
)
45 // Test raw transaction API argument handling
48 BOOST_CHECK_THROW(CallRPC("getrawtransaction"), std::runtime_error
);
49 BOOST_CHECK_THROW(CallRPC("getrawtransaction not_hex"), std::runtime_error
);
50 BOOST_CHECK_THROW(CallRPC("getrawtransaction a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed not_int"), std::runtime_error
);
52 BOOST_CHECK_THROW(CallRPC("createrawtransaction"), std::runtime_error
);
53 BOOST_CHECK_THROW(CallRPC("createrawtransaction null null"), std::runtime_error
);
54 BOOST_CHECK_THROW(CallRPC("createrawtransaction not_array"), std::runtime_error
);
55 BOOST_CHECK_THROW(CallRPC("createrawtransaction [] []"), std::runtime_error
);
56 BOOST_CHECK_THROW(CallRPC("createrawtransaction {} {}"), std::runtime_error
);
57 BOOST_CHECK_NO_THROW(CallRPC("createrawtransaction [] {}"));
58 BOOST_CHECK_THROW(CallRPC("createrawtransaction [] {} extra"), std::runtime_error
);
60 BOOST_CHECK_THROW(CallRPC("decoderawtransaction"), std::runtime_error
);
61 BOOST_CHECK_THROW(CallRPC("decoderawtransaction null"), std::runtime_error
);
62 BOOST_CHECK_THROW(CallRPC("decoderawtransaction DEADBEEF"), std::runtime_error
);
63 std::string rawtx
= "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000";
64 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("decoderawtransaction ")+rawtx
));
65 BOOST_CHECK_EQUAL(find_value(r
.get_obj(), "size").get_int(), 193);
66 BOOST_CHECK_EQUAL(find_value(r
.get_obj(), "version").get_int(), 1);
67 BOOST_CHECK_EQUAL(find_value(r
.get_obj(), "locktime").get_int(), 0);
68 BOOST_CHECK_THROW(r
= CallRPC(std::string("decoderawtransaction ")+rawtx
+" extra"), std::runtime_error
);
70 BOOST_CHECK_THROW(CallRPC("signrawtransaction"), std::runtime_error
);
71 BOOST_CHECK_THROW(CallRPC("signrawtransaction null"), std::runtime_error
);
72 BOOST_CHECK_THROW(CallRPC("signrawtransaction ff00"), std::runtime_error
);
73 BOOST_CHECK_NO_THROW(CallRPC(std::string("signrawtransaction ")+rawtx
));
74 BOOST_CHECK_NO_THROW(CallRPC(std::string("signrawtransaction ")+rawtx
+" null null NONE|ANYONECANPAY"));
75 BOOST_CHECK_NO_THROW(CallRPC(std::string("signrawtransaction ")+rawtx
+" [] [] NONE|ANYONECANPAY"));
76 BOOST_CHECK_THROW(CallRPC(std::string("signrawtransaction ")+rawtx
+" null null badenum"), std::runtime_error
);
78 // Only check failure cases for sendrawtransaction, there's no network to send to...
79 BOOST_CHECK_THROW(CallRPC("sendrawtransaction"), std::runtime_error
);
80 BOOST_CHECK_THROW(CallRPC("sendrawtransaction null"), std::runtime_error
);
81 BOOST_CHECK_THROW(CallRPC("sendrawtransaction DEADBEEF"), std::runtime_error
);
82 BOOST_CHECK_THROW(CallRPC(std::string("sendrawtransaction ")+rawtx
+" extra"), std::runtime_error
);
85 BOOST_AUTO_TEST_CASE(rpc_togglenetwork
)
89 r
= CallRPC("getnetworkinfo");
90 bool netState
= find_value(r
.get_obj(), "networkactive").get_bool();
91 BOOST_CHECK_EQUAL(netState
, true);
93 BOOST_CHECK_NO_THROW(CallRPC("setnetworkactive false"));
94 r
= CallRPC("getnetworkinfo");
95 int numConnection
= find_value(r
.get_obj(), "connections").get_int();
96 BOOST_CHECK_EQUAL(numConnection
, 0);
98 netState
= find_value(r
.get_obj(), "networkactive").get_bool();
99 BOOST_CHECK_EQUAL(netState
, false);
101 BOOST_CHECK_NO_THROW(CallRPC("setnetworkactive true"));
102 r
= CallRPC("getnetworkinfo");
103 netState
= find_value(r
.get_obj(), "networkactive").get_bool();
104 BOOST_CHECK_EQUAL(netState
, true);
107 BOOST_AUTO_TEST_CASE(rpc_rawsign
)
110 // input is a 1-of-2 multisig (so is output):
111 std::string prevout
=
112 "[{\"txid\":\"b4cc287e58f87cdae59417329f710f3ecd75a4ee1d2872b7248f50977c8493f3\","
113 "\"vout\":1,\"scriptPubKey\":\"a914b10c9df5f7edf436c697f02f1efdba4cf399615187\","
114 "\"redeemScript\":\"512103debedc17b3df2badbcdd86d5feb4562b86fe182e5998abd8bcd4f122c6155b1b21027e940bb73ab8732bfdf7f9216ecefca5b94d6df834e77e108f68e66f126044c052ae\"}]";
115 r
= CallRPC(std::string("createrawtransaction ")+prevout
+" "+
116 "{\"3HqAe9LtNBjnsfM4CyYaWTnvCaUYT7v4oZ\":11}");
117 std::string notsigned
= r
.get_str();
118 std::string privkey1
= "\"KzsXybp9jX64P5ekX1KUxRQ79Jht9uzW7LorgwE65i5rWACL6LQe\"";
119 std::string privkey2
= "\"Kyhdf5LuKTRx4ge69ybABsiUAWjVRK4XGxAKk2FQLp2HjGMy87Z4\"";
120 r
= CallRPC(std::string("signrawtransaction ")+notsigned
+" "+prevout
+" "+"[]");
121 BOOST_CHECK(find_value(r
.get_obj(), "complete").get_bool() == false);
122 r
= CallRPC(std::string("signrawtransaction ")+notsigned
+" "+prevout
+" "+"["+privkey1
+","+privkey2
+"]");
123 BOOST_CHECK(find_value(r
.get_obj(), "complete").get_bool() == true);
126 BOOST_AUTO_TEST_CASE(rpc_createraw_op_return
)
128 BOOST_CHECK_NO_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"data\":\"68656c6c6f776f726c64\"}"));
130 // Allow more than one data transaction output
131 BOOST_CHECK_NO_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"data\":\"68656c6c6f776f726c64\",\"data\":\"68656c6c6f776f726c64\"}"));
133 // Key not "data" (bad address)
134 BOOST_CHECK_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"somedata\":\"68656c6c6f776f726c64\"}"), std::runtime_error
);
136 // Bad hex encoding of data output
137 BOOST_CHECK_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"data\":\"12345\"}"), std::runtime_error
);
138 BOOST_CHECK_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"data\":\"12345g\"}"), std::runtime_error
);
140 // Data 81 bytes long
141 BOOST_CHECK_NO_THROW(CallRPC("createrawtransaction [{\"txid\":\"a3b807410df0b60fcb9736768df5823938b2f838694939ba45f3c0a1bff150ed\",\"vout\":0}] {\"data\":\"010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081\"}"));
144 BOOST_AUTO_TEST_CASE(rpc_format_monetary_values
)
146 BOOST_CHECK(ValueFromAmount(0LL).write() == "0.00000000");
147 BOOST_CHECK(ValueFromAmount(1LL).write() == "0.00000001");
148 BOOST_CHECK(ValueFromAmount(17622195LL).write() == "0.17622195");
149 BOOST_CHECK(ValueFromAmount(50000000LL).write() == "0.50000000");
150 BOOST_CHECK(ValueFromAmount(89898989LL).write() == "0.89898989");
151 BOOST_CHECK(ValueFromAmount(100000000LL).write() == "1.00000000");
152 BOOST_CHECK(ValueFromAmount(2099999999999990LL).write() == "20999999.99999990");
153 BOOST_CHECK(ValueFromAmount(2099999999999999LL).write() == "20999999.99999999");
155 BOOST_CHECK_EQUAL(ValueFromAmount(0).write(), "0.00000000");
156 BOOST_CHECK_EQUAL(ValueFromAmount((COIN
/10000)*123456789).write(), "12345.67890000");
157 BOOST_CHECK_EQUAL(ValueFromAmount(-COIN
).write(), "-1.00000000");
158 BOOST_CHECK_EQUAL(ValueFromAmount(-COIN
/10).write(), "-0.10000000");
160 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*100000000).write(), "100000000.00000000");
161 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*10000000).write(), "10000000.00000000");
162 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*1000000).write(), "1000000.00000000");
163 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*100000).write(), "100000.00000000");
164 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*10000).write(), "10000.00000000");
165 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*1000).write(), "1000.00000000");
166 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*100).write(), "100.00000000");
167 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
*10).write(), "10.00000000");
168 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
).write(), "1.00000000");
169 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/10).write(), "0.10000000");
170 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/100).write(), "0.01000000");
171 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/1000).write(), "0.00100000");
172 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/10000).write(), "0.00010000");
173 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/100000).write(), "0.00001000");
174 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/1000000).write(), "0.00000100");
175 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/10000000).write(), "0.00000010");
176 BOOST_CHECK_EQUAL(ValueFromAmount(COIN
/100000000).write(), "0.00000001");
179 static UniValue
ValueFromString(const std::string
&str
)
182 BOOST_CHECK(value
.setNumStr(str
));
186 BOOST_AUTO_TEST_CASE(rpc_parse_monetary_values
)
188 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("-0.00000001")), UniValue
);
189 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0")), 0LL);
190 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000000")), 0LL);
191 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000001")), 1LL);
192 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.17622195")), 17622195LL);
193 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.5")), 50000000LL);
194 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.50000000")), 50000000LL);
195 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.89898989")), 89898989LL);
196 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("1.00000000")), 100000000LL);
197 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("20999999.9999999")), 2099999999999990LL);
198 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("20999999.99999999")), 2099999999999999LL);
200 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("1e-8")), COIN
/100000000);
201 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.1e-7")), COIN
/100000000);
202 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.01e-6")), COIN
/100000000);
203 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.0000000000000000000000000000000000000000000000000000000000000000000000000001e+68")), COIN
/100000000);
204 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("10000000000000000000000000000000000000000000000000000000000000000e-64")), COIN
);
205 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000e64")), COIN
);
207 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("1e-9")), UniValue
); //should fail
208 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("0.000000019")), UniValue
); //should fail
209 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000001000000")), 1LL); //should pass, cut trailing 0
210 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("19e-9")), UniValue
); //should fail
211 BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.19e-6")), 19); //should pass, leading 0 is present
213 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("92233720368.54775808")), UniValue
); //overflow error
214 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("1e+11")), UniValue
); //overflow error
215 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("1e11")), UniValue
); //overflow error signless
216 BOOST_CHECK_THROW(AmountFromValue(ValueFromString("93e+9")), UniValue
); //overflow error
219 BOOST_AUTO_TEST_CASE(json_parse_errors
)
222 BOOST_CHECK_EQUAL(ParseNonRFCJSONValue("1.0").get_real(), 1.0);
223 // Valid, with leading or trailing whitespace
224 BOOST_CHECK_EQUAL(ParseNonRFCJSONValue(" 1.0").get_real(), 1.0);
225 BOOST_CHECK_EQUAL(ParseNonRFCJSONValue("1.0 ").get_real(), 1.0);
227 BOOST_CHECK_THROW(AmountFromValue(ParseNonRFCJSONValue(".19e-6")), std::runtime_error
); //should fail, missing leading 0, therefore invalid JSON
228 BOOST_CHECK_EQUAL(AmountFromValue(ParseNonRFCJSONValue("0.00000000000000000000000000000000000001e+30 ")), 1);
229 // Invalid, initial garbage
230 BOOST_CHECK_THROW(ParseNonRFCJSONValue("[1.0"), std::runtime_error
);
231 BOOST_CHECK_THROW(ParseNonRFCJSONValue("a1.0"), std::runtime_error
);
232 // Invalid, trailing garbage
233 BOOST_CHECK_THROW(ParseNonRFCJSONValue("1.0sds"), std::runtime_error
);
234 BOOST_CHECK_THROW(ParseNonRFCJSONValue("1.0]"), std::runtime_error
);
235 // BTC addresses should fail parsing
236 BOOST_CHECK_THROW(ParseNonRFCJSONValue("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"), std::runtime_error
);
237 BOOST_CHECK_THROW(ParseNonRFCJSONValue("3J98t1WpEZ73CNmQviecrnyiWrnqRhWNL"), std::runtime_error
);
240 BOOST_AUTO_TEST_CASE(rpc_ban
)
242 BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
245 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 127.0.0.0 add")));
246 BOOST_CHECK_THROW(r
= CallRPC(std::string("setban 127.0.0.0:8334")), std::runtime_error
); //portnumber for setban not allowed
247 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
248 UniValue ar
= r
.get_array();
249 UniValue o1
= ar
[0].get_obj();
250 UniValue adr
= find_value(o1
, "address");
251 BOOST_CHECK_EQUAL(adr
.get_str(), "127.0.0.0/32");
252 BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0 remove")));
253 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
255 BOOST_CHECK_EQUAL(ar
.size(), 0);
257 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 127.0.0.0/24 add 1607731200 true")));
258 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
260 o1
= ar
[0].get_obj();
261 adr
= find_value(o1
, "address");
262 UniValue banned_until
= find_value(o1
, "banned_until");
263 BOOST_CHECK_EQUAL(adr
.get_str(), "127.0.0.0/24");
264 BOOST_CHECK_EQUAL(banned_until
.get_int64(), 1607731200); // absolute time check
266 BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
268 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 127.0.0.0/24 add 200")));
269 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
271 o1
= ar
[0].get_obj();
272 adr
= find_value(o1
, "address");
273 banned_until
= find_value(o1
, "banned_until");
274 BOOST_CHECK_EQUAL(adr
.get_str(), "127.0.0.0/24");
275 int64_t now
= GetTime();
276 BOOST_CHECK(banned_until
.get_int64() > now
);
277 BOOST_CHECK(banned_until
.get_int64()-now
<= 200);
279 // must throw an exception because 127.0.0.1 is in already banned suubnet range
280 BOOST_CHECK_THROW(r
= CallRPC(std::string("setban 127.0.0.1 add")), std::runtime_error
);
282 BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0/24 remove")));
283 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
285 BOOST_CHECK_EQUAL(ar
.size(), 0);
287 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 127.0.0.0/255.255.0.0 add")));
288 BOOST_CHECK_THROW(r
= CallRPC(std::string("setban 127.0.1.1 add")), std::runtime_error
);
290 BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
291 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
293 BOOST_CHECK_EQUAL(ar
.size(), 0);
296 BOOST_CHECK_THROW(r
= CallRPC(std::string("setban test add")), std::runtime_error
); //invalid IP
299 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban FE80:0000:0000:0000:0202:B3FF:FE1E:8329 add")));
300 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
302 o1
= ar
[0].get_obj();
303 adr
= find_value(o1
, "address");
304 BOOST_CHECK_EQUAL(adr
.get_str(), "fe80::202:b3ff:fe1e:8329/128");
306 BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
307 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 2001:db8::/ffff:fffc:0:0:0:0:0:0 add")));
308 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
310 o1
= ar
[0].get_obj();
311 adr
= find_value(o1
, "address");
312 BOOST_CHECK_EQUAL(adr
.get_str(), "2001:db8::/30");
314 BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
315 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("setban 2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/128 add")));
316 BOOST_CHECK_NO_THROW(r
= CallRPC(std::string("listbanned")));
318 o1
= ar
[0].get_obj();
319 adr
= find_value(o1
, "address");
320 BOOST_CHECK_EQUAL(adr
.get_str(), "2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/128");
323 BOOST_AUTO_TEST_CASE(rpc_convert_values_generatetoaddress
)
327 BOOST_CHECK_NO_THROW(result
= RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a")));
328 BOOST_CHECK_EQUAL(result
[0].get_int(), 101);
329 BOOST_CHECK_EQUAL(result
[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a");
331 BOOST_CHECK_NO_THROW(result
= RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU")));
332 BOOST_CHECK_EQUAL(result
[0].get_int(), 101);
333 BOOST_CHECK_EQUAL(result
[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU");
335 BOOST_CHECK_NO_THROW(result
= RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a")("9")));
336 BOOST_CHECK_EQUAL(result
[0].get_int(), 1);
337 BOOST_CHECK_EQUAL(result
[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a");
338 BOOST_CHECK_EQUAL(result
[2].get_int(), 9);
340 BOOST_CHECK_NO_THROW(result
= RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU")("9")));
341 BOOST_CHECK_EQUAL(result
[0].get_int(), 1);
342 BOOST_CHECK_EQUAL(result
[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU");
343 BOOST_CHECK_EQUAL(result
[2].get_int(), 9);
346 BOOST_AUTO_TEST_SUITE_END()