mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
RPC: fix generatetoaddress failing to parse address and add unit test
This commit is contained in:
parent
ff5874bcf7
commit
60361ca481
@ -30,7 +30,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
|||||||
{ "generate", 0 },
|
{ "generate", 0 },
|
||||||
{ "generate", 1 },
|
{ "generate", 1 },
|
||||||
{ "generatetoaddress", 0 },
|
{ "generatetoaddress", 0 },
|
||||||
{ "generatetoaddress", 1 },
|
|
||||||
{ "generatetoaddress", 2 },
|
{ "generatetoaddress", 2 },
|
||||||
{ "getnetworkhashps", 0 },
|
{ "getnetworkhashps", 0 },
|
||||||
{ "getnetworkhashps", 1 },
|
{ "getnetworkhashps", 1 },
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/assign/list_of.hpp>
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
@ -308,4 +309,27 @@ BOOST_AUTO_TEST_CASE(rpc_ban)
|
|||||||
BOOST_CHECK_EQUAL(adr.get_str(), "2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/128");
|
BOOST_CHECK_EQUAL(adr.get_str(), "2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/128");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(rpc_convert_values_generatetoaddress)
|
||||||
|
{
|
||||||
|
UniValue result;
|
||||||
|
|
||||||
|
BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a")));
|
||||||
|
BOOST_CHECK_EQUAL(result[0].get_int(), 101);
|
||||||
|
BOOST_CHECK_EQUAL(result[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a");
|
||||||
|
|
||||||
|
BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU")));
|
||||||
|
BOOST_CHECK_EQUAL(result[0].get_int(), 101);
|
||||||
|
BOOST_CHECK_EQUAL(result[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU");
|
||||||
|
|
||||||
|
BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a")("9")));
|
||||||
|
BOOST_CHECK_EQUAL(result[0].get_int(), 1);
|
||||||
|
BOOST_CHECK_EQUAL(result[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a");
|
||||||
|
BOOST_CHECK_EQUAL(result[2].get_int(), 9);
|
||||||
|
|
||||||
|
BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU")("9")));
|
||||||
|
BOOST_CHECK_EQUAL(result[0].get_int(), 1);
|
||||||
|
BOOST_CHECK_EQUAL(result[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU");
|
||||||
|
BOOST_CHECK_EQUAL(result[2].get_int(), 9);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user