Config file options cleanup

This commit is contained in:
serkixenos 2022-07-11 18:30:39 +02:00
parent 73163d2722
commit 47023be7c5
7 changed files with 92 additions and 81 deletions

View file

@ -79,7 +79,7 @@ private:
uint32_t rpc_port;
std::string user;
std::string password;
std::string wallet;
std::string wallet_name;
std::string wallet_password;
bool debug_rpc_calls;
@ -130,17 +130,18 @@ private:
std::string ip;
uint32_t zmq_port;
uint32_t rpc_port;
uint32_t bitcoin_major_version;
std::string rpc_user;
std::string rpc_password;
std::string wallet;
std::string wallet_name;
std::string wallet_password;
std::unique_ptr<bitcoin_rpc_client> bitcoin_client;
std::unique_ptr<zmq_listener> listener;
fc::future<void> on_changed_objects_task;
bitcoin::bitcoin_address::network network_type;
uint32_t bitcoin_major_version;
std::mutex event_handler_mutex;
typedef std::lock_guard<decltype(event_handler_mutex)> scoped_lock;

View file

@ -39,9 +39,11 @@ public:
bool settle_sidechain_transaction(const sidechain_transaction_object &sto, asset &settle_amount);
private:
std::string node_rpc_url;
std::string node_rpc_user;
std::string node_rpc_password;
std::string rpc_url;
std::string rpc_user;
std::string rpc_password;
std::string wallet_contract_address;
ethereum_rpc_client *ethereum_client;
ethereum::chain_id_type chain_id;

View file

@ -12,9 +12,9 @@
namespace graphene { namespace peerplays_sidechain {
class hive_node_rpc_client : public rpc_client {
class hive_rpc_client : public rpc_client {
public:
hive_node_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls);
hive_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls);
std::string account_history_api_get_transaction(std::string transaction_id);
std::string block_api_get_block(uint32_t block_number);
@ -48,10 +48,12 @@ public:
bool settle_sidechain_transaction(const sidechain_transaction_object &sto, asset &settle_amount);
private:
std::string node_rpc_url;
std::string node_rpc_user;
std::string node_rpc_password;
hive_node_rpc_client *node_rpc_client;
std::string rpc_url;
std::string rpc_user;
std::string rpc_password;
std::string wallet_account_name;
hive_rpc_client *rpc_client;
hive::chain_id_type chain_id;
hive::network network_type;

View file

@ -152,7 +152,7 @@ void peerplays_sidechain_plugin_impl::plugin_set_program_options(
cli.add_options()("bitcoin-node-rpc-port", bpo::value<uint32_t>()->default_value(8332), "RPC port of Bitcoin node");
cli.add_options()("bitcoin-node-rpc-user", bpo::value<string>()->default_value("1"), "Bitcoin RPC user");
cli.add_options()("bitcoin-node-rpc-password", bpo::value<string>()->default_value("1"), "Bitcoin RPC password");
cli.add_options()("bitcoin-wallet", bpo::value<string>(), "Bitcoin wallet");
cli.add_options()("bitcoin-wallet-name", bpo::value<string>(), "Bitcoin wallet name");
cli.add_options()("bitcoin-wallet-password", bpo::value<string>(), "Bitcoin wallet password");
cli.add_options()("bitcoin-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("02d0f137e717fb3aab7aff99904001d49a0a636c5e1342f8927a4ba2eaee8e9772", "cVN31uC9sTEr392DLVUEjrtMgLA8Yb3fpYmTRj7bomTm6nn2ANPr")),
"Tuple of [Bitcoin public key, Bitcoin private key] (may specify multiple times)");
@ -161,15 +161,17 @@ void peerplays_sidechain_plugin_impl::plugin_set_program_options(
cli.add_options()("ethereum-node-rpc-url", bpo::value<string>()->default_value("127.0.0.1:8545"), "Ethereum node RPC URL [http[s]://]host[:port]");
cli.add_options()("ethereum-node-rpc-user", bpo::value<string>(), "Ethereum RPC user");
cli.add_options()("ethereum-node-rpc-password", bpo::value<string>(), "Ethereum RPC password");
cli.add_options()("ethereum-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("5fbbb31be52608d2f52247e8400b7fcaa9e0bc12", "9bedac2bd8fe2a6f6528e066c67fc8ac0622e96828d40c0e820d83c5bd2b0589")),
"Tuple of [Ethereum public key, Ethereum private key] (may specify multiple times)");
cli.add_options()("ethereum-wallet-contract-address", bpo::value<string>()->default_value("0000000000000000000000000000000000000000"), "Ethereum wallet contract address"),
cli.add_options()("ethereum-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("5fbbb31be52608d2f52247e8400b7fcaa9e0bc12", "9bedac2bd8fe2a6f6528e066c67fc8ac0622e96828d40c0e820d83c5bd2b0589")),
"Tuple of [Ethereum public key, Ethereum private key] (may specify multiple times)");
cli.add_options()("hive-sidechain-enabled", bpo::value<bool>()->default_value(false), "Hive sidechain handler enabled");
cli.add_options()("hive-node-rpc-url", bpo::value<string>()->default_value("127.0.0.1:28090"), "Hive node RPC URL [http[s]://]host[:port]");
cli.add_options()("hive-node-rpc-user", bpo::value<string>(), "Hive node RPC user");
cli.add_options()("hive-node-rpc-password", bpo::value<string>(), "Hive node RPC password");
cli.add_options()("hive-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4", "5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n")),
"Tuple of [Hive public key, Hive private key] (may specify multiple times)");
cli.add_options()("hive-wallet-account-name", bpo::value<string>()->default_value("son-account"), "Hive wallet account name"),
cli.add_options()("hive-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4", "5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n")),
"Tuple of [Hive public key, Hive private key] (may specify multiple times)");
cfg.add(cli);
}

View file

@ -25,12 +25,12 @@ namespace graphene { namespace peerplays_sidechain {
// =============================================================================
bitcoin_rpc_client::bitcoin_rpc_client(std::string _ip, uint32_t _rpc, std::string _user, std::string _password, std::string _wallet, std::string _wallet_password, bool _debug_rpc_calls) :
bitcoin_rpc_client::bitcoin_rpc_client(std::string _ip, uint32_t _rpc, std::string _user, std::string _password, std::string _wallet_name, std::string _wallet_password, bool _debug_rpc_calls) :
ip(_ip),
rpc_port(_rpc),
user(_user),
password(_password),
wallet(_wallet),
wallet_name(_wallet_name),
wallet_password(_wallet_password),
debug_rpc_calls(_debug_rpc_calls) {
authorization.key = "Authorization";
@ -1036,8 +1036,8 @@ fc::http::reply bitcoin_rpc_client::send_post_request(std::string body, bool sho
std::string url = "http://" + ip + ":" + std::to_string(rpc_port);
if (wallet.length() > 0) {
url = url + "/wallet/" + wallet;
if (wallet_name.length() > 0) {
url = url + "/wallet/" + wallet_name;
}
fc::http::reply reply = conn.request("POST", url, body, fc::http::headers{authorization});
@ -1136,9 +1136,9 @@ sidechain_net_handler_bitcoin::sidechain_net_handler_bitcoin(peerplays_sidechain
rpc_port = options.at("bitcoin-node-rpc-port").as<uint32_t>();
rpc_user = options.at("bitcoin-node-rpc-user").as<std::string>();
rpc_password = options.at("bitcoin-node-rpc-password").as<std::string>();
wallet = "";
if (options.count("bitcoin-wallet")) {
wallet = options.at("bitcoin-wallet").as<std::string>();
wallet_name = "";
if (options.count("bitcoin-wallet-name")) {
wallet_name = options.at("bitcoin-wallet-name").as<std::string>();
}
wallet_password = "";
if (options.count("bitcoin-wallet-password")) {
@ -1165,9 +1165,9 @@ sidechain_net_handler_bitcoin::sidechain_net_handler_bitcoin(peerplays_sidechain
FC_ASSERT(false);
}
bitcoin_client = std::unique_ptr<bitcoin_rpc_client>(new bitcoin_rpc_client(ip, rpc_port, rpc_user, rpc_password, wallet, wallet_password, debug_rpc_calls));
if (!wallet.empty()) {
bitcoin_client->loadwallet(wallet);
bitcoin_client = std::unique_ptr<bitcoin_rpc_client>(new bitcoin_rpc_client(ip, rpc_port, rpc_user, rpc_password, wallet_name, wallet_password, debug_rpc_calls));
if (!wallet_name.empty()) {
bitcoin_client->loadwallet(wallet_name);
}
std::string blockchain_info = bitcoin_client->getblockchaininfo();

View file

@ -57,18 +57,20 @@ sidechain_net_handler_ethereum::sidechain_net_handler_ethereum(peerplays_sidecha
debug_rpc_calls = options.at("debug-rpc-calls").as<bool>();
}
node_rpc_url = options.at("ethereum-node-rpc-url").as<std::string>();
rpc_url = options.at("ethereum-node-rpc-url").as<std::string>();
if (options.count("ethereum-node-rpc-user")) {
node_rpc_user = options.at("ethereum-node-rpc-user").as<std::string>();
rpc_user = options.at("ethereum-node-rpc-user").as<std::string>();
} else {
node_rpc_user = "";
rpc_user = "";
}
if (options.count("ethereum-node-rpc-password")) {
node_rpc_password = options.at("ethereum-node-rpc-password").as<std::string>();
rpc_password = options.at("ethereum-node-rpc-password").as<std::string>();
} else {
node_rpc_password = "";
rpc_password = "";
}
wallet_contract_address = options.at("ethereum-wallet-contract-address").as<std::string>();
if (options.count("ethereum-private-key")) {
const std::vector<std::string> pub_priv_keys = options["ethereum-private-key"].as<std::vector<std::string>>();
for (const std::string &itr_key_pair : pub_priv_keys) {
@ -81,11 +83,11 @@ sidechain_net_handler_ethereum::sidechain_net_handler_ethereum(peerplays_sidecha
}
}
ethereum_client = new ethereum_rpc_client(node_rpc_url, node_rpc_user, node_rpc_password, debug_rpc_calls);
ethereum_client = new ethereum_rpc_client(rpc_url, rpc_user, rpc_password, debug_rpc_calls);
std::string chain_id_str = ethereum_client->get_chain_id();
if (chain_id_str.empty()) {
elog("No Ethereum node running at ${url}", ("url", node_rpc_url));
elog("No Ethereum node running at ${url}", ("url", rpc_url));
FC_ASSERT(false);
}
chain_id = std::stoll(chain_id_str);

View file

@ -30,21 +30,21 @@
namespace graphene { namespace peerplays_sidechain {
hive_node_rpc_client::hive_node_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls) :
hive_rpc_client::hive_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls) :
rpc_client(url, user_name, password, debug_rpc_calls) {
}
std::string hive_node_rpc_client::account_history_api_get_transaction(std::string transaction_id) {
std::string hive_rpc_client::account_history_api_get_transaction(std::string transaction_id) {
std::string params = "{ \"id\": \"" + transaction_id + "\" }";
return send_post_request("account_history_api.get_transaction", params, debug_rpc_calls);
}
std::string hive_node_rpc_client::block_api_get_block(uint32_t block_number) {
std::string hive_rpc_client::block_api_get_block(uint32_t block_number) {
std::string params = "{ \"block_num\": " + std::to_string(block_number) + " }";
return send_post_request("block_api.get_block", params, debug_rpc_calls);
}
std::string hive_node_rpc_client::condenser_api_get_accounts(std::vector<std::string> accounts) {
std::string hive_rpc_client::condenser_api_get_accounts(std::vector<std::string> accounts) {
std::string params = "";
for (auto account : accounts) {
if (!params.empty()) {
@ -56,58 +56,58 @@ std::string hive_node_rpc_client::condenser_api_get_accounts(std::vector<std::st
return send_post_request("condenser_api.get_accounts", params, debug_rpc_calls);
}
std::string hive_node_rpc_client::condenser_api_get_config() {
std::string hive_rpc_client::condenser_api_get_config() {
std::string params = "[]";
return send_post_request("condenser_api.get_config", params, debug_rpc_calls);
}
std::string hive_node_rpc_client::database_api_get_dynamic_global_properties() {
std::string hive_rpc_client::database_api_get_dynamic_global_properties() {
return send_post_request("database_api.get_dynamic_global_properties", "", debug_rpc_calls);
}
std::string hive_node_rpc_client::database_api_get_version() {
std::string hive_rpc_client::database_api_get_version() {
return send_post_request("database_api.get_version", "", debug_rpc_calls);
}
std::string hive_node_rpc_client::network_broadcast_api_broadcast_transaction(std::string htrx) {
std::string hive_rpc_client::network_broadcast_api_broadcast_transaction(std::string htrx) {
std::string params = "{ \"trx\": " + htrx + ", \"max_block_age\": -1 }";
return send_post_request("network_broadcast_api.broadcast_transaction", params, debug_rpc_calls);
}
std::string hive_node_rpc_client::get_account(std::string account) {
std::string hive_rpc_client::get_account(std::string account) {
std::vector<std::string> accounts;
accounts.push_back(account);
std::string reply_str = condenser_api_get_accounts(accounts);
return retrieve_array_value_from_reply(reply_str, "", 0);
}
std::string hive_node_rpc_client::get_account_memo_key(std::string account) {
std::string hive_rpc_client::get_account_memo_key(std::string account) {
std::string reply_str = get_account(account);
reply_str = "{\"result\":" + reply_str + "}";
return retrieve_value_from_reply(reply_str, "memo_key");
}
std::string hive_node_rpc_client::get_chain_id() {
std::string hive_rpc_client::get_chain_id() {
std::string reply_str = database_api_get_version();
return retrieve_value_from_reply(reply_str, "chain_id");
}
std::string hive_node_rpc_client::get_head_block_id() {
std::string hive_rpc_client::get_head_block_id() {
std::string reply_str = database_api_get_dynamic_global_properties();
return retrieve_value_from_reply(reply_str, "head_block_id");
}
std::string hive_node_rpc_client::get_head_block_time() {
std::string hive_rpc_client::get_head_block_time() {
std::string reply_str = database_api_get_dynamic_global_properties();
return retrieve_value_from_reply(reply_str, "time");
}
std::string hive_node_rpc_client::get_is_test_net() {
std::string hive_rpc_client::get_is_test_net() {
std::string reply_str = condenser_api_get_config();
return retrieve_value_from_reply(reply_str, "IS_TEST_NET");
}
std::string hive_node_rpc_client::get_last_irreversible_block_num() {
std::string hive_rpc_client::get_last_irreversible_block_num() {
std::string reply_str = database_api_get_dynamic_global_properties();
return retrieve_value_from_reply(reply_str, "last_irreversible_block_num");
}
@ -120,18 +120,20 @@ sidechain_net_handler_hive::sidechain_net_handler_hive(peerplays_sidechain_plugi
debug_rpc_calls = options.at("debug-rpc-calls").as<bool>();
}
node_rpc_url = options.at("hive-node-rpc-url").as<std::string>();
if (options.count("hive-node-rpc-user")) {
node_rpc_user = options.at("hive-node-rpc-user").as<std::string>();
rpc_url = options.at("hive-rpc-url").as<std::string>();
if (options.count("hive-rpc-user")) {
rpc_user = options.at("hive-rpc-user").as<std::string>();
} else {
node_rpc_user = "";
rpc_user = "";
}
if (options.count("hive-node-rpc-password")) {
node_rpc_password = options.at("hive-node-rpc-password").as<std::string>();
if (options.count("hive-rpc-password")) {
rpc_password = options.at("hive-rpc-password").as<std::string>();
} else {
node_rpc_password = "";
rpc_password = "";
}
wallet_account_name = options.at("hive-wallet-account-name").as<std::string>();
if (options.count("hive-private-key")) {
const std::vector<std::string> pub_priv_keys = options["hive-private-key"].as<std::vector<std::string>>();
for (const std::string &itr_key_pair : pub_priv_keys) {
@ -144,16 +146,16 @@ sidechain_net_handler_hive::sidechain_net_handler_hive(peerplays_sidechain_plugi
}
}
node_rpc_client = new hive_node_rpc_client(node_rpc_url, node_rpc_user, node_rpc_password, debug_rpc_calls);
rpc_client = new hive_rpc_client(rpc_url, rpc_user, rpc_password, debug_rpc_calls);
std::string chain_id_str = node_rpc_client->get_chain_id();
std::string chain_id_str = rpc_client->get_chain_id();
if (chain_id_str.empty()) {
elog("No Hive node running at ${url}", ("url", node_rpc_url));
elog("No Hive node running at ${url}", ("url", rpc_url));
FC_ASSERT(false);
}
chain_id = chain_id_type(chain_id_str);
std::string is_test_net = node_rpc_client->get_is_test_net();
std::string is_test_net = rpc_client->get_is_test_net();
network_type = is_test_net.compare("true") == 0 ? hive::network::testnet : hive::network::mainnet;
if (network_type == hive::network::mainnet) {
ilog("Running on Hive mainnet, chain id ${chain_id_str}", ("chain_id_str", chain_id_str));
@ -223,7 +225,7 @@ bool sidechain_net_handler_hive::process_proposal(const proposal_object &po) {
}
if (son_sets_equal) {
address_ok = (op_obj_idx_0.get<son_wallet_update_operation>().address == "son-account");
address_ok = (op_obj_idx_0.get<son_wallet_update_operation>().address == wallet_account_name);
}
if (po.proposed_transaction.operations.size() >= 2) {
@ -252,14 +254,14 @@ bool sidechain_net_handler_hive::process_proposal(const proposal_object &po) {
account_auths[wallet_son.sidechain_public_keys.at(sidechain)] = wallet_son.weight;
}
std::string memo_key = node_rpc_client->get_account_memo_key("son-account");
std::string memo_key = rpc_client->get_account_memo_key(wallet_account_name);
hive::authority active;
active.weight_threshold = total_weight * 2 / 3 + 1;
active.account_auths = account_auths;
hive::account_update_operation auo;
auo.account = "son-account";
auo.account = wallet_account_name;
auo.active = active;
auo.memo_key = op_trx.operations[0].get<hive::account_update_operation>().memo_key;
@ -301,7 +303,7 @@ bool sidechain_net_handler_hive::process_proposal(const proposal_object &po) {
uint64_t swdo_sidechain_amount = swdo->sidechain_amount.value;
uint64_t swdo_op_idx = std::stoll(swdo->sidechain_uid.substr(swdo->sidechain_uid.find_last_of("-")));
std::string tx_str = node_rpc_client->account_history_api_get_transaction(swdo_txid);
std::string tx_str = rpc_client->account_history_api_get_transaction(swdo_txid);
if (tx_str != "") {
std::stringstream ss_tx(tx_str);
@ -406,7 +408,7 @@ bool sidechain_net_handler_hive::process_proposal(const proposal_object &po) {
}
hive::transfer_operation t_op;
t_op.from = "son-account";
t_op.from = wallet_account_name;
t_op.to = swwo->withdraw_address;
t_op.amount.amount = swwo->withdraw_amount;
t_op.amount.symbol = symbol;
@ -493,7 +495,7 @@ void sidechain_net_handler_hive::process_primary_wallet() {
account_auths[active_son.sidechain_public_keys.at(sidechain)] = active_son.weight;
}
std::string memo_key = node_rpc_client->get_account_memo_key("son-account");
std::string memo_key = rpc_client->get_account_memo_key(wallet_account_name);
if (memo_key.empty()) {
return;
@ -504,14 +506,14 @@ void sidechain_net_handler_hive::process_primary_wallet() {
active.account_auths = account_auths;
hive::account_update_operation auo;
auo.account = "son-account";
auo.account = wallet_account_name;
auo.active = active;
auo.memo_key = hive::public_key_type(memo_key);
std::string block_id_str = node_rpc_client->get_head_block_id();
std::string block_id_str = rpc_client->get_head_block_id();
hive::block_id_type head_block_id(block_id_str);
std::string head_block_time_str = node_rpc_client->get_head_block_time();
std::string head_block_time_str = rpc_client->get_head_block_time();
time_point head_block_time = fc::time_point_sec::from_iso_string(head_block_time_str);
hive::signed_transaction htrx;
@ -536,7 +538,7 @@ void sidechain_net_handler_hive::process_primary_wallet() {
swu_op.payer = gpo.parameters.son_account();
swu_op.son_wallet_id = active_sw->id;
swu_op.sidechain = sidechain;
swu_op.address = "son-account";
swu_op.address = wallet_account_name;
proposal_op.proposed_ops.emplace_back(swu_op);
@ -660,16 +662,16 @@ bool sidechain_net_handler_hive::process_withdrawal(const son_wallet_withdraw_ob
}
hive::transfer_operation t_op;
t_op.from = "son-account";
t_op.from = wallet_account_name;
t_op.to = swwo.withdraw_address;
t_op.amount.amount = swwo.withdraw_amount;
t_op.amount.symbol = symbol;
t_op.memo = "";
std::string block_id_str = node_rpc_client->get_head_block_id();
std::string block_id_str = rpc_client->get_head_block_id();
hive::block_id_type head_block_id(block_id_str);
std::string head_block_time_str = node_rpc_client->get_head_block_time();
std::string head_block_time_str = rpc_client->get_head_block_time();
time_point head_block_time = fc::time_point_sec::from_iso_string(head_block_time_str);
hive::signed_transaction htrx;
@ -725,7 +727,7 @@ std::string sidechain_net_handler_hive::process_sidechain_transaction(const side
hive::signed_transaction htrx;
fc::raw::unpack(ss_trx, htrx, 1000);
std::string chain_id_str = node_rpc_client->get_chain_id();
std::string chain_id_str = rpc_client->get_chain_id();
const hive::chain_id_type chain_id(chain_id_str);
fc::optional<fc::ecc::private_key> privkey = graphene::utilities::wif_to_key(get_private_key(plugin.get_current_son_object().sidechain_public_keys.at(sidechain)));
@ -753,7 +755,7 @@ std::string sidechain_net_handler_hive::send_sidechain_transaction(const sidecha
}
std::string params = fc::json::to_string(htrx);
node_rpc_client->network_broadcast_api_broadcast_transaction(params);
rpc_client->network_broadcast_api_broadcast_transaction(params);
return htrx.id().str();
}
@ -768,7 +770,7 @@ bool sidechain_net_handler_hive::settle_sidechain_transaction(const sidechain_tr
return false;
}
std::string tx_str = node_rpc_client->account_history_api_get_transaction(sto.sidechain_transaction);
std::string tx_str = rpc_client->account_history_api_get_transaction(sto.sidechain_transaction);
if (tx_str != "") {
std::stringstream ss_tx(tx_str);
@ -779,7 +781,7 @@ bool sidechain_net_handler_hive::settle_sidechain_transaction(const sidechain_tr
std::string tx_txid = tx_json.get<std::string>("result.transaction_id");
uint32_t tx_block_num = tx_json.get<uint32_t>("result.block_num");
uint32_t last_irreversible_block = std::stoul(node_rpc_client->get_last_irreversible_block_num());
uint32_t last_irreversible_block = std::stoul(rpc_client->get_last_irreversible_block_num());
//std::string tx_address = addr.get_address();
//int64_t tx_amount = -1;
@ -815,7 +817,7 @@ void sidechain_net_handler_hive::schedule_hive_listener() {
void sidechain_net_handler_hive::hive_listener_loop() {
schedule_hive_listener();
std::string reply = node_rpc_client->database_api_get_dynamic_global_properties();
std::string reply = rpc_client->database_api_get_dynamic_global_properties();
if (!reply.empty()) {
std::stringstream ss(reply);
boost::property_tree::ptree json;
@ -830,7 +832,7 @@ void sidechain_net_handler_hive::hive_listener_loop() {
}
}
//std::string reply = node_rpc_client->get_last_irreversible_block_num();
//std::string reply = rpc_client->get_last_irreversible_block_num();
//if (!reply.empty()) {
// uint64_t last_irreversible_block = std::stoul(reply);
// if (last_irreversible_block != last_block_received) {
@ -842,7 +844,7 @@ void sidechain_net_handler_hive::hive_listener_loop() {
}
void sidechain_net_handler_hive::handle_event(const std::string &event_data) {
std::string block = node_rpc_client->block_api_get_block(std::atoll(event_data.c_str()));
std::string block = rpc_client->block_api_get_block(std::atoll(event_data.c_str()));
if (block != "") {
add_to_son_listener_log("BLOCK : " + event_data);
std::stringstream ss(block);
@ -867,7 +869,7 @@ void sidechain_net_handler_hive::handle_event(const std::string &event_data) {
std::string from = op_value.get<std::string>("from");
std::string to = op_value.get<std::string>("to");
if (to == "son-account") {
if (to == wallet_account_name) {
const auto &amount_child = op_value.get_child("amount");