Code formatting
This commit is contained in:
parent
85e99c994f
commit
c3fc60171a
2 changed files with 11 additions and 13 deletions
|
|
@ -23,18 +23,16 @@ public:
|
|||
|
||||
class bitcoin_rpc_client {
|
||||
public:
|
||||
enum class multi_type
|
||||
{
|
||||
enum class multi_type {
|
||||
script,
|
||||
address
|
||||
};
|
||||
struct multi_params
|
||||
{
|
||||
multi_params(multi_type _type, const std::string& _address_or_script, const std::string& _label = "")
|
||||
: type{_type}
|
||||
, address_or_script{_address_or_script}
|
||||
, label{_label}
|
||||
{}
|
||||
struct multi_params {
|
||||
multi_params(multi_type _type, const std::string &_address_or_script, const std::string &_label = "") :
|
||||
type{_type},
|
||||
address_or_script{_address_or_script},
|
||||
label{_label} {
|
||||
}
|
||||
|
||||
multi_type type;
|
||||
std::string address_or_script;
|
||||
|
|
@ -61,7 +59,7 @@ public:
|
|||
std::string gettransaction(const std::string &txid, const bool include_watch_only = false);
|
||||
std::string getblockchaininfo();
|
||||
void importaddress(const std::string &address_or_script, const std::string &label = "", const bool rescan = true, const bool p2sh = false);
|
||||
void importmulti(const std::vector<multi_params>& address_or_script_array, const bool rescan = true);
|
||||
void importmulti(const std::vector<multi_params> &address_or_script_array, const bool rescan = true);
|
||||
std::vector<btc_txout> listunspent(const uint32_t minconf = 1, const uint32_t maxconf = 9999999);
|
||||
std::vector<btc_txout> listunspent_by_address_and_amount(const std::string &address, double transfer_amount, const uint32_t minconf = 1, const uint32_t maxconf = 9999999);
|
||||
std::string loadwallet(const std::string &filename);
|
||||
|
|
|
|||
|
|
@ -572,12 +572,12 @@ 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) {
|
||||
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\": [");
|
||||
|
||||
std::string argument_1 = "[";
|
||||
for(const auto& param : address_or_script_array) {
|
||||
for (const auto ¶m : address_or_script_array) {
|
||||
argument_1 += "{\"scriptPubKey\": ";
|
||||
if (param.type == multi_type::address)
|
||||
argument_1 += "{\"address\": \"" + param.address_or_script + "\"}";
|
||||
|
|
@ -1981,7 +1981,7 @@ void sidechain_net_handler_bitcoin::on_changed_objects_cb(const vector<object_id
|
|||
}
|
||||
}
|
||||
|
||||
if(!address_or_script_array.empty())
|
||||
if (!address_or_script_array.empty())
|
||||
bitcoin_client->importmulti(address_or_script_array);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue