clang-format

This commit is contained in:
Vlad Dobromyslov 2023-10-30 20:20:29 +03:00
parent ac8b6114af
commit 41f53b3196
17 changed files with 279 additions and 284 deletions

View file

@ -368,8 +368,7 @@ vector<operation_history_object> history_api::get_account_history(const std::str
return _app.elasticsearch_thread->async([&es, &account, &stop, &limit, &start]() {
return es->get_account_history(account, stop, limit, start);
},
"thread invoke for method " BOOST_PP_STRINGIZE(method_name))
.wait();
"thread invoke for method " BOOST_PP_STRINGIZE(method_name)).wait();
}
}

View file

@ -733,7 +733,7 @@ public:
low_block_num += (true_high_block_num - low_block_num + 2) / 2;
} while (low_block_num <= high_block_num);
//idump((synopsis));
// idump((synopsis));
return synopsis;
}
FC_CAPTURE_AND_RETHROW()

View file

@ -313,7 +313,7 @@ public:
uint32_t api_limit_get_trade_history = 100;
uint32_t api_limit_get_trade_history_by_sequence = 100;
//private:
// private:
const account_object *get_account_from_string(const std::string &name_or_id,
bool throw_if_not_found = true) const;
const asset_object *get_asset_from_string(const std::string &symbol_or_id,
@ -470,7 +470,7 @@ void database_api::set_subscribe_callback(std::function<void(const variant &)> c
}
void database_api_impl::set_subscribe_callback(std::function<void(const variant &)> cb, bool notify_remove_create) {
//edump((clear_filter));
// edump((clear_filter));
_subscribe_callback = cb;
_notify_remove_create = notify_remove_create;
_subscribed_accounts.clear();
@ -2903,7 +2903,7 @@ graphene::app::gpos_info database_api::get_gpos_info(const account_id_type accou
}
graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type account) const {
FC_ASSERT(_db.head_block_time() > HARDFORK_GPOS_TIME); //Can be deleted after GPOS hardfork time
FC_ASSERT(_db.head_block_time() > HARDFORK_GPOS_TIME); // Can be deleted after GPOS hardfork time
gpos_info result;
result.vesting_factor = _db.calculate_vesting_factor(account(_db));
@ -3550,8 +3550,8 @@ void database_api_impl::handle_object_changed(bool force_notify, bool full_objec
/// pushing the future back / popping the prior future if it is complete.
/// if a connection hangs then this could get backed up and result in
/// a failure to exit cleanly.
//fc::async([capture_this,this,updates,market_broadcast_queue](){
//if( _subscribe_callback )
// fc::async([capture_this,this,updates,market_broadcast_queue](){
// if( _subscribe_callback )
// _subscribe_callback( updates );
for (auto id : ids) {

View file

@ -152,7 +152,7 @@ void bitcoin_transaction_builder::add_in(payment_type type, tx_in txin, const by
txin.scriptSig = script_code;
break;
default: {
if (txin.prevout.hash == fc::sha256("0000000000000000000000000000000000000000000000000000000000000000")) { //coinbase
if (txin.prevout.hash == fc::sha256("0000000000000000000000000000000000000000000000000000000000000000")) { // coinbase
FC_ASSERT(script_code != bytes());
txin.scriptSig = script_code;
}

View file

@ -3,9 +3,9 @@
#include <system_error>
#include <bitcoin/explorer/callback_state.hpp>
#include <bitcoin/explorer/config/transaction.hpp>
#include <bitcoin/system/config/hash256.hpp>
#include <bitcoin/explorer/callback_state.hpp>
#include <boost/xpressive/xpressive.hpp>
@ -56,7 +56,7 @@ libbitcoin_client::libbitcoin_client(std::string url) :
}
libbitcoin_client::~libbitcoin_client() {
if( poller_trx_thr.joinable()) {
if (poller_trx_thr.joinable()) {
stop_poller_trx_thread = true;
poller_transacion_done.notify_all();
poller_trx_thr.join();
@ -89,7 +89,7 @@ std::string libbitcoin_client::send_transaction(std::string tx) {
return res;
}
bool libbitcoin_client::get_transaction(const std::string tx, libbitcoin::chain::transaction& trx) {
bool libbitcoin_client::get_transaction(const std::string tx, libbitcoin::chain::transaction &trx) {
bool result = false;
auto error_handler = [&](const std::error_code &ec) {
elog("error on fetch_trx_by_hash: ${hash} ${error_code}", ("hash", tx)("error_code", ec.message()));
@ -157,7 +157,7 @@ std::vector<list_unspent_replay> libbitcoin_client::listunspent(std::string addr
bool libbitcoin_client::get_is_test_net() {
if(is_test_net != -1) {
if (is_test_net != -1) {
return is_test_net;
}
@ -266,7 +266,7 @@ void libbitcoin_client::subscribe_to_address(const std::string address_str, addr
void libbitcoin_client::poller_transaction_thr() {
std::unique_lock<std::mutex> lck(trxs_pool_mutex);
while(!stop_poller_trx_thread) {
while (!stop_poller_trx_thread) {
libbitcoin::chain::transaction trx;
if (!target_trxs_pool.empty() && get_transaction(libbitcoin::config::hash256(target_trxs_pool.back()).to_string(), trx)) {
@ -285,7 +285,6 @@ bool libbitcoin_client::is_target_trxs_pool_empty() {
return target_trxs_pool.empty();
}
void libbitcoin_client::subscription_thr() {
libbitcoin::wallet::payment_address address(subscription_add);
@ -306,7 +305,7 @@ void libbitcoin_client::subscription_thr() {
if (height == 0) {
std::unique_lock<std::mutex> lck(trxs_pool_mutex);
target_trxs_pool.emplace_back(tx_hash);
} else if((get_transaction(libbitcoin::config::hash256(tx_hash).to_string(), trx))){
} else if ((get_transaction(libbitcoin::config::hash256(tx_hash).to_string(), trx))) {
address_updated_callback_handler(trx, get_is_test_net());
}
}
@ -318,7 +317,7 @@ void libbitcoin_client::subscription_thr() {
obelisk_client.monitor(SUBSCRIBE_TIME_DURATION);
if( poller_trx_thr.joinable()) {
if (poller_trx_thr.joinable()) {
stop_poller_trx_thread = true;
poller_transacion_done.notify_all();
poller_trx_thr.join();

View file

@ -384,7 +384,7 @@ rpc_client::~rpc_client() {
if (connection_selection_task.valid())
connection_selection_task.cancel_and_wait(__FUNCTION__);
} catch (fc::canceled_exception &) {
//Expected exception. Move along.
// Expected exception. Move along.
} catch (fc::exception &e) {
edump((e.to_detail_string()));
}

View file

@ -23,10 +23,10 @@ namespace graphene { namespace peerplays_sidechain {
typedef std::function<void(const libbitcoin::chain::block &)>
block_update_handler;
typedef std::function<void(const libbitcoin::chain::transaction& trx, const bool& is_test_net)>
typedef std::function<void(const libbitcoin::chain::transaction &trx, const bool &is_test_net)>
address_update_handler;
typedef std::function<void(const std::string& )>
typedef std::function<void(const std::string &)>
subscription_expired_handler;
struct list_unspent_replay {
@ -40,7 +40,7 @@ public:
libbitcoin_client(std::string url);
~libbitcoin_client();
std::string send_transaction(const std::string tx);
bool get_transaction(const std::string tx, libbitcoin::chain::transaction& trx);
bool get_transaction(const std::string tx, libbitcoin::chain::transaction &trx);
libbitcoin::chain::output::list get_transaction_outs(std::string tx_id, std::string &tx_hash, uint32_t &confirmitions);
std::vector<list_unspent_replay> listunspent(std::string address, double amount);
uint64_t get_average_fee_from_trxs(std::vector<libbitcoin::chain::transaction> trx_list);

View file

@ -22,15 +22,15 @@ typedef fc::ecc::private_key private_key_type;
typedef fc::sha256 chain_id_type;
typedef std::string account_name_type;
typedef fc::ripemd160 block_id_type;
//typedef fc::ripemd160 checksum_type;
// typedef fc::ripemd160 checksum_type;
typedef fc::ripemd160 transaction_id_type;
typedef fc::sha256 digest_type;
typedef fc::ecc::compact_signature signature_type;
typedef fc::safe<int64_t> share_type;
//typedef safe<uint64_t> ushare_type;
//typedef uint16_t weight_type;
//typedef uint32_t contribution_id_type;
//typedef fixed_string<32> custom_id_type;
// typedef safe<uint64_t> ushare_type;
// typedef uint16_t weight_type;
// typedef uint32_t contribution_id_type;
// typedef fixed_string<32> custom_id_type;
struct public_key_type {

View file

@ -246,17 +246,17 @@ private:
std::string sign_transaction(const sidechain_transaction_object &sto);
std::string send_transaction(const sidechain_transaction_object &sto);
void extract_deposit(const std::vector<info_for_vin> vins) ;
void extract_deposit(const std::vector<info_for_vin> vins);
void block_handle_event(const block_data &event_data);
void subscribe_address_thread();
void trx_handle_event(const libbitcoin::chain::transaction &event_data);
void subscription_expired_event(const std::string& address);
void subscription_expired_event(const std::string &address);
std::string get_redeemscript_for_userdeposit(const std::string &user_address);
void on_changed_objects(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
void on_changed_objects_cb(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
std::map<std::string, std::pair<std::unique_ptr<libbitcoin_client>, bool>> libbitcoin_clients;
void trx_event(const libbitcoin::chain::transaction &trx, const bool& is_test_net);
void trx_event(const libbitcoin::chain::transaction &trx, const bool &is_test_net);
bool stop_sub_thr = true;

View file

@ -145,7 +145,7 @@ peerplays_sidechain_plugin_impl::~peerplays_sidechain_plugin_impl() {
if (_heartbeat_task.valid())
_heartbeat_task.cancel_and_wait(__FUNCTION__);
} catch (fc::canceled_exception &) {
//Expected exception. Move along.
// Expected exception. Move along.
} catch (fc::exception &e) {
edump((e.to_detail_string()));
}
@ -156,7 +156,7 @@ peerplays_sidechain_plugin_impl::~peerplays_sidechain_plugin_impl() {
_son_processing_task.at(active_sidechain_type).wait();
}
} catch (fc::canceled_exception &) {
//Expected exception. Move along.
// Expected exception. Move along.
} catch (fc::exception &e) {
edump((e.to_detail_string()));
}
@ -540,11 +540,11 @@ void peerplays_sidechain_plugin_impl::son_processing(sidechain_type sidechain) {
return;
}
//fc::time_point now_fine = fc::time_point::now();
//fc::time_point_sec now = now_fine + fc::microseconds(500000);
//if (plugin.database().get_slot_time(1) < now) {
// fc::time_point now_fine = fc::time_point::now();
// fc::time_point_sec now = now_fine + fc::microseconds(500000);
// if (plugin.database().get_slot_time(1) < now) {
// return; // Not synced
//}
// }
const fc::time_point now_fine = fc::time_point::now();
const fc::time_point_sec now = now_fine - fc::milliseconds(3000);
@ -873,15 +873,12 @@ void peerplays_sidechain_plugin_impl::settle_sidechain_transactions(sidechain_ty
void peerplays_sidechain_plugin_impl::on_applied_block(const signed_block &b) {
if (first_block_skipped) {
if(son_processing_enabled) {
if (son_processing_enabled) {
schedule_son_processing();
}
else
{
} else {
const fc::time_point now_fine = fc::time_point::now();
const fc::time_point_sec now = now_fine + fc::microseconds( 500000 );
if( plugin.database().get_slot_time(1) >= now )
{
const fc::time_point_sec now = now_fine + fc::microseconds(500000);
if (plugin.database().get_slot_time(1) >= now) {
son_processing_enabled = true;
schedule_son_processing();
}

View file

@ -184,7 +184,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
bool enable_peerplays_asset_deposits = false;
#ifdef ENABLE_PEERPLAYS_ASSET_DEPOSITS
//enable_peerplays_asset_deposits = (sed.sidechain == sidechain_type::peerplays) &&
// enable_peerplays_asset_deposits = (sed.sidechain == sidechain_type::peerplays) &&
// (sed.sidechain_currency.compare("BTC") != 0) &&
// (sed.sidechain_currency.compare("ETH") != 0) &&
// (sed.sidechain_currency.compare("HBD") != 0) &&
@ -451,7 +451,7 @@ void sidechain_net_handler::process_deposits() {
if (swdo.id == object_id_type(0, 0, 0) || !plugin.can_son_participate(sidechain, chain::operation::tag<chain::son_wallet_deposit_process_operation>::value, swdo.id)) {
return;
}
//Ignore the deposits which are not valid anymore, considered refunds.
// Ignore the deposits which are not valid anymore, considered refunds.
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_sidechain_and_deposit_address_and_expires>();
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sidechain, swdo.sidechain_from, time_point_sec::maximum()));
if (addr_itr == sidechain_addresses_idx.end()) {

View file

@ -766,7 +766,7 @@ sidechain_net_handler_bitcoin::~sidechain_net_handler_bitcoin() {
on_changed_objects_task.cancel_and_wait(__FUNCTION__);
}
if(subscribe_thr.joinable()) {
if (subscribe_thr.joinable()) {
stop_sub_thr = true;
subscribe_thr.join();
}
@ -1699,7 +1699,7 @@ void sidechain_net_handler_bitcoin::subscription_expired_event(const std::string
}
}
void sidechain_net_handler_bitcoin::trx_event(const libbitcoin::chain::transaction& trx, const bool& is_test_net) {
void sidechain_net_handler_bitcoin::trx_event(const libbitcoin::chain::transaction &trx, const bool &is_test_net) {
scoped_lock interlock(event_handler_mutex);
std::vector<info_for_vin> result;
uint32_t vout_seq = 0;

View file

@ -757,8 +757,8 @@ bool sidechain_net_handler_ethereum::settle_sidechain_transaction(const sidechai
if ("0x1" == json_receipt.get<std::string>("result.status")) {
count += 1;
//! Fixme - compare data somehow?
//if( sto.transaction == entry_receipt.second.get<std::string>("data") ) {
//}
// if( sto.transaction == entry_receipt.second.get<std::string>("data") ) {
// }
}
}

View file

@ -858,14 +858,14 @@ bool sidechain_net_handler_hive::settle_sidechain_transaction(const sidechain_tr
boost::property_tree::ptree tx_json;
boost::property_tree::read_json(ss_tx, tx_json);
//const chain::global_property_object &gpo = database.get_global_properties();
// const chain::global_property_object &gpo = database.get_global_properties();
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");
const 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;
// std::string tx_address = addr.get_address();
// int64_t tx_amount = -1;
if (tx_block_num <= last_irreversible_block) {
if (sto.object_id.is<son_wallet_withdraw_id_type>()) {
@ -918,15 +918,15 @@ void sidechain_net_handler_hive::hive_listener_loop() {
}
}
//std::string reply = rpc_client->get_last_irreversible_block_num();
//if (!reply.empty()) {
// 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) {
// std::string event_data = std::to_string(last_irreversible_block);
// handle_event(event_data);
// last_block_received = last_irreversible_block;
// }
//}
// }
}
void sidechain_net_handler_hive::handle_event(const std::string &event_data) {
@ -960,7 +960,7 @@ void sidechain_net_handler_hive::handle_event(const std::string &event_data) {
const auto &amount_child = op_value.get_child("amount");
uint64_t amount = amount_child.get<uint64_t>("amount");
//uint64_t precision = amount_child.get<uint64_t>("precision");
// uint64_t precision = amount_child.get<uint64_t>("precision");
std::string nai = amount_child.get<std::string>("nai");
std::string sidechain_currency = "";
price sidechain_currency_price = {};

View file

@ -24,15 +24,15 @@ namespace graphene { namespace peerplays_sidechain {
sidechain_net_handler_peerplays::sidechain_net_handler_peerplays(peerplays_sidechain_plugin &_plugin, const boost::program_options::variables_map &options) :
sidechain_net_handler(sidechain_type::peerplays, _plugin, options) {
//const auto &assets_by_symbol = database.get_index_type<asset_index>().indices().get<by_symbol>();
//const auto get_asset_id = [&assets_by_symbol](const string &symbol) {
// const auto &assets_by_symbol = database.get_index_type<asset_index>().indices().get<by_symbol>();
// const auto get_asset_id = [&assets_by_symbol](const string &symbol) {
// auto asset_itr = assets_by_symbol.find(symbol);
// FC_ASSERT(asset_itr != assets_by_symbol.end(), "Unable to find asset '${sym}'", ("sym", symbol));
// return asset_itr->get_id();
//};
//tracked_assets.push_back(get_asset_id("PBTC"));
//tracked_assets.push_back(get_asset_id("PETH"));
//tracked_assets.push_back(get_asset_id("PEOS"));
// };
// tracked_assets.push_back(get_asset_id("PBTC"));
// tracked_assets.push_back(get_asset_id("PETH"));
// tracked_assets.push_back(get_asset_id("PEOS"));
if (options.count("peerplays-private-key")) {
const std::vector<std::string> pub_priv_keys = options["peerplays-private-key"].as<std::vector<std::string>>();
@ -284,8 +284,8 @@ bool sidechain_net_handler_peerplays::settle_sidechain_transaction(const sidecha
}
if (sto.object_id.is<son_wallet_deposit_id_type>()) {
//auto swdo = database.get<son_wallet_deposit_object>(sto.object_id);
//settle_amount = asset(swdo.sidechain_amount, swdo.sidechain_currency);
// auto swdo = database.get<son_wallet_deposit_object>(sto.object_id);
// settle_amount = asset(swdo.sidechain_amount, swdo.sidechain_currency);
}
if (sto.object_id.is<son_wallet_withdraw_id_type>()) {