Code formatting
This commit is contained in:
parent
3a90f3eaca
commit
4324091de3
1 changed files with 57 additions and 141 deletions
|
|
@ -41,8 +41,7 @@ bitcoin_rpc_client::bitcoin_rpc_client(std::string _ip, uint32_t _rpc, std::stri
|
|||
std::string bitcoin_rpc_client::addmultisigaddress(const uint32_t nrequired, const std::vector<std::string> public_keys) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"addmultisigaddress\", "
|
||||
"\"method\": \"addmultisigaddress\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = std::to_string(nrequired) + ", [";
|
||||
std::string pubkeys = "";
|
||||
for (std::string pubkey : public_keys) {
|
||||
|
|
@ -73,9 +72,7 @@ std::string bitcoin_rpc_client::addmultisigaddress(const uint32_t nrequired, con
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -84,8 +81,7 @@ std::string bitcoin_rpc_client::addmultisigaddress(const uint32_t nrequired, con
|
|||
std::string bitcoin_rpc_client::combinepsbt(const vector<std::string> &psbts) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"combinepsbt\", \"method\": "
|
||||
"\"combinepsbt\", \"params\": [[");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = "";
|
||||
for (std::string psbt : psbts) {
|
||||
if (!params.empty()) {
|
||||
|
|
@ -115,9 +111,7 @@ std::string bitcoin_rpc_client::combinepsbt(const vector<std::string> &psbts) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -126,8 +120,7 @@ std::string bitcoin_rpc_client::combinepsbt(const vector<std::string> &psbts) {
|
|||
std::string bitcoin_rpc_client::createmultisig(const uint32_t nrequired, const std::vector<std::string> public_keys) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"createmultisig\", "
|
||||
"\"method\": \"createmultisig\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = std::to_string(nrequired) + ", [";
|
||||
std::string pubkeys = "";
|
||||
for (std::string pubkey : public_keys) {
|
||||
|
|
@ -158,9 +151,7 @@ std::string bitcoin_rpc_client::createmultisig(const uint32_t nrequired, const s
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -169,8 +160,7 @@ std::string bitcoin_rpc_client::createmultisig(const uint32_t nrequired, const s
|
|||
std::string bitcoin_rpc_client::createpsbt(const std::vector<btc_txout> &ins, const fc::flat_map<std::string, double> outs) {
|
||||
std::string body("{\"jsonrpc\": \"1.0\", \"id\":\"createpsbt\", "
|
||||
"\"method\": \"createpsbt\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
body += "[";
|
||||
bool first = true;
|
||||
for (const auto &entry : ins) {
|
||||
|
|
@ -210,9 +200,7 @@ std::string bitcoin_rpc_client::createpsbt(const std::vector<btc_txout> &ins, co
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -221,8 +209,7 @@ std::string bitcoin_rpc_client::createpsbt(const std::vector<btc_txout> &ins, co
|
|||
std::string bitcoin_rpc_client::createrawtransaction(const std::vector<btc_txout> &ins, const fc::flat_map<std::string, double> outs) {
|
||||
std::string body("{\"jsonrpc\": \"1.0\", \"id\":\"createrawtransaction\", "
|
||||
"\"method\": \"createrawtransaction\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
body += "[";
|
||||
bool first = true;
|
||||
for (const auto &entry : ins) {
|
||||
|
|
@ -262,9 +249,7 @@ std::string bitcoin_rpc_client::createrawtransaction(const std::vector<btc_txout
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -274,8 +259,7 @@ std::string bitcoin_rpc_client::createwallet(const std::string &wallet_name) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"createwallet\", \"method\": "
|
||||
"\"createwallet\", \"params\": [\"" +
|
||||
wallet_name + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -297,9 +281,7 @@ std::string bitcoin_rpc_client::createwallet(const std::string &wallet_name) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -309,8 +291,7 @@ std::string bitcoin_rpc_client::decodepsbt(std::string const &tx_psbt) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"decodepsbt\", \"method\": "
|
||||
"\"decodepsbt\", \"params\": [\"" +
|
||||
tx_psbt + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -332,9 +313,7 @@ std::string bitcoin_rpc_client::decodepsbt(std::string const &tx_psbt) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -344,8 +323,7 @@ std::string bitcoin_rpc_client::decoderawtransaction(std::string const &tx_hex)
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"decoderawtransaction\", \"method\": "
|
||||
"\"decoderawtransaction\", \"params\": [\"" +
|
||||
tx_hex + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -367,9 +345,7 @@ std::string bitcoin_rpc_client::decoderawtransaction(std::string const &tx_hex)
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -379,8 +355,7 @@ std::string bitcoin_rpc_client::encryptwallet(const std::string &passphrase) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"encryptwallet\", \"method\": "
|
||||
"\"encryptwallet\", \"params\": [\"" +
|
||||
passphrase + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -402,9 +377,7 @@ std::string bitcoin_rpc_client::encryptwallet(const std::string &passphrase) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -414,8 +387,7 @@ uint64_t bitcoin_rpc_client::estimatesmartfee(uint16_t conf_target) {
|
|||
const auto body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"estimatesmartfee\", "
|
||||
"\"method\": \"estimatesmartfee\", \"params\": [" +
|
||||
std::to_string(conf_target) + std::string("] }"));
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -446,9 +418,7 @@ uint64_t bitcoin_rpc_client::estimatesmartfee(uint16_t conf_target) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return 20000;
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return 20000;
|
||||
}
|
||||
|
|
@ -458,8 +428,7 @@ std::string bitcoin_rpc_client::finalizepsbt(std::string const &tx_psbt) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"finalizepsbt\", \"method\": "
|
||||
"\"finalizepsbt\", \"params\": [\"" +
|
||||
tx_psbt + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -479,9 +448,7 @@ std::string bitcoin_rpc_client::finalizepsbt(std::string const &tx_psbt) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -491,8 +458,7 @@ std::string bitcoin_rpc_client::getaddressinfo(const std::string &address) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"getaddressinfo\", \"method\": "
|
||||
"\"getaddressinfo\", \"params\": [\"" +
|
||||
address + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -514,9 +480,7 @@ std::string bitcoin_rpc_client::getaddressinfo(const std::string &address) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -526,8 +490,7 @@ std::string bitcoin_rpc_client::getblock(const std::string &block_hash, int32_t
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"getblock\", \"method\": "
|
||||
"\"getblock\", \"params\": [\"" +
|
||||
block_hash + "\", " + std::to_string(verbosity) + "] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -549,9 +512,7 @@ std::string bitcoin_rpc_client::getblock(const std::string &block_hash, int32_t
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -560,8 +521,7 @@ std::string bitcoin_rpc_client::getblock(const std::string &block_hash, int32_t
|
|||
std::string bitcoin_rpc_client::getnetworkinfo() {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"getnetworkinfo\", \"method\": "
|
||||
"\"getnetworkinfo\", \"params\": [] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -582,9 +542,7 @@ std::string bitcoin_rpc_client::getnetworkinfo() {
|
|||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -593,8 +551,7 @@ std::string bitcoin_rpc_client::getnetworkinfo() {
|
|||
std::string bitcoin_rpc_client::getrawtransaction(const std::string &txid, const bool verbose) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"getrawtransaction\", \"method\": "
|
||||
"\"getrawtransaction\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = "\"" + txid + "\", " + (verbose ? "true" : "false");
|
||||
body = body + params + "] }";
|
||||
|
||||
|
|
@ -617,9 +574,7 @@ std::string bitcoin_rpc_client::getrawtransaction(const std::string &txid, const
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -628,8 +583,7 @@ std::string bitcoin_rpc_client::getrawtransaction(const std::string &txid, const
|
|||
std::string bitcoin_rpc_client::gettransaction(const std::string &txid, const bool include_watch_only) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"gettransaction\", \"method\": "
|
||||
"\"gettransaction\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = "\"" + txid + "\", " + (include_watch_only ? "true" : "false");
|
||||
body = body + params + "] }";
|
||||
|
||||
|
|
@ -652,9 +606,7 @@ std::string bitcoin_rpc_client::gettransaction(const std::string &txid, const bo
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -663,8 +615,7 @@ std::string bitcoin_rpc_client::gettransaction(const std::string &txid, const bo
|
|||
std::string bitcoin_rpc_client::getblockchaininfo() {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"getblockchaininfo\", \"method\": "
|
||||
"\"getblockchaininfo\", \"params\": [] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -686,9 +637,7 @@ std::string bitcoin_rpc_client::getblockchaininfo() {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -697,8 +646,7 @@ std::string bitcoin_rpc_client::getblockchaininfo() {
|
|||
void bitcoin_rpc_client::importaddress(const std::string &address_or_script, const std::string &label, const bool rescan, const bool p2sh) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"importaddress\", "
|
||||
"\"method\": \"importaddress\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string params = "\"" + address_or_script + "\", " +
|
||||
"\"" + label + "\", " +
|
||||
(rescan ? "true" : "false") + ", " +
|
||||
|
|
@ -721,9 +669,7 @@ void bitcoin_rpc_client::importaddress(const std::string &address_or_script, con
|
|||
} else if (json.count("error") && !json.get_child("error").empty()) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
}
|
||||
}
|
||||
|
|
@ -731,8 +677,7 @@ void bitcoin_rpc_client::importaddress(const std::string &address_or_script, con
|
|||
void bitcoin_rpc_client::importmulti(const std::vector<multi_params> &address_or_script_array, const bool rescan) {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"importmulti\", "
|
||||
"\"method\": \"importmulti\", \"params\": [");
|
||||
try
|
||||
{
|
||||
try {
|
||||
std::string argument_1 = "[";
|
||||
for (const auto ¶m : address_or_script_array) {
|
||||
argument_1 += "{\"scriptPubKey\": ";
|
||||
|
|
@ -778,9 +723,7 @@ void bitcoin_rpc_client::importmulti(const std::vector<multi_params> &address_or
|
|||
} else if (json.count("error") && !json.get_child("error").empty()) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
}
|
||||
}
|
||||
|
|
@ -789,10 +732,9 @@ std::vector<btc_txout> bitcoin_rpc_client::listunspent(const uint32_t minconf, c
|
|||
const auto body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"pp_plugin\", \"method\": "
|
||||
"\"listunspent\", \"params\": [" +
|
||||
std::to_string(minconf) + "," + std::to_string(maxconf) + "] }");
|
||||
|
||||
|
||||
std::vector<btc_txout> result;
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -820,9 +762,7 @@ std::vector<btc_txout> bitcoin_rpc_client::listunspent(const uint32_t minconf, c
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return result;
|
||||
}
|
||||
|
|
@ -840,8 +780,7 @@ std::vector<btc_txout> bitcoin_rpc_client::listunspent_by_address_and_amount(con
|
|||
|
||||
std::vector<btc_txout> result;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -869,9 +808,7 @@ std::vector<btc_txout> bitcoin_rpc_client::listunspent_by_address_and_amount(con
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return result;
|
||||
}
|
||||
|
|
@ -881,8 +818,7 @@ std::string bitcoin_rpc_client::loadwallet(const std::string &filename) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"loadwallet\", \"method\": "
|
||||
"\"loadwallet\", \"params\": [\"" +
|
||||
filename + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -904,9 +840,7 @@ std::string bitcoin_rpc_client::loadwallet(const std::string &filename) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -916,8 +850,7 @@ std::string bitcoin_rpc_client::sendrawtransaction(const std::string &tx_hex) {
|
|||
const auto body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"sendrawtransaction\", "
|
||||
"\"method\": \"sendrawtransaction\", \"params\": [") +
|
||||
std::string("\"") + tx_hex + std::string("\"") + std::string("] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -937,9 +870,7 @@ std::string bitcoin_rpc_client::sendrawtransaction(const std::string &tx_hex) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -951,8 +882,7 @@ std::string bitcoin_rpc_client::signrawtransactionwithwallet(const std::string &
|
|||
std::string params = "\"" + tx_hash + "\"";
|
||||
body = body + params + std::string("]}");
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -972,9 +902,7 @@ std::string bitcoin_rpc_client::signrawtransactionwithwallet(const std::string &
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -984,8 +912,7 @@ std::string bitcoin_rpc_client::unloadwallet(const std::string &filename) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"unloadwallet\", \"method\": "
|
||||
"\"unloadwallet\", \"params\": [\"" +
|
||||
filename + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -1007,9 +934,7 @@ std::string bitcoin_rpc_client::unloadwallet(const std::string &filename) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -1018,8 +943,7 @@ std::string bitcoin_rpc_client::unloadwallet(const std::string &filename) {
|
|||
std::string bitcoin_rpc_client::walletlock() {
|
||||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"walletlock\", \"method\": "
|
||||
"\"walletlock\", \"params\": [] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -1041,9 +965,7 @@ std::string bitcoin_rpc_client::walletlock() {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -1053,8 +975,7 @@ std::string bitcoin_rpc_client::walletprocesspsbt(std::string const &tx_psbt) {
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"walletprocesspsbt\", \"method\": "
|
||||
"\"walletprocesspsbt\", \"params\": [\"" +
|
||||
tx_psbt + "\"] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -1074,9 +995,7 @@ std::string bitcoin_rpc_client::walletprocesspsbt(std::string const &tx_psbt) {
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return "";
|
||||
}
|
||||
|
|
@ -1086,8 +1005,7 @@ bool bitcoin_rpc_client::walletpassphrase(const std::string &passphrase, uint32_
|
|||
std::string body = std::string("{\"jsonrpc\": \"1.0\", \"id\":\"walletpassphrase\", \"method\": "
|
||||
"\"walletpassphrase\", \"params\": [\"" +
|
||||
passphrase + "\", " + std::to_string(timeout) + "] }");
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto reply = send_post_request(body, debug_rpc_calls);
|
||||
|
||||
if (reply.body.empty()) {
|
||||
|
|
@ -1107,9 +1025,7 @@ bool bitcoin_rpc_client::walletpassphrase(const std::string &passphrase, uint32_
|
|||
wlog("Bitcoin RPC call ${function} with body ${body} failed with reply '${msg}'", ("function", __FUNCTION__)("body", body)("msg", ss.str()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch(const boost::exception& ex)
|
||||
{
|
||||
} catch (const boost::exception &ex) {
|
||||
wlog("Bitcoin RPC call ${function} with body ${body} generate exception: '${exception}'", ("function", __FUNCTION__)("body", body)("exception", boost::diagnostic_information(ex)));
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue