All dev features enabled/disabled with single flag
This commit is contained in:
parent
b6514577a7
commit
56ec93e6ce
3 changed files with 21 additions and 11 deletions
|
|
@ -9,12 +9,12 @@ add_library( peerplays_sidechain
|
||||||
bitcoin_utils.cpp
|
bitcoin_utils.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (SUPPORT_MULTIPLE_SONS)
|
if (ENABLE_DEV_FEATURES)
|
||||||
message ("Multiple SONs per software instance are supported")
|
message ("Dev features enabled")
|
||||||
target_compile_definitions(peerplays_sidechain PRIVATE SUPPORT_MULTIPLE_SONS)
|
target_compile_definitions(peerplays_sidechain PRIVATE ENABLE_DEV_FEATURES)
|
||||||
endif()
|
endif()
|
||||||
unset(SUPPORT_MULTIPLE_SONS)
|
unset(ENABLE_DEV_FEATURES)
|
||||||
unset(SUPPORT_MULTIPLE_SONS CACHE)
|
unset(ENABLE_DEV_FEATURES CACHE)
|
||||||
|
|
||||||
target_link_libraries( peerplays_sidechain graphene_chain graphene_app fc zmq )
|
target_link_libraries( peerplays_sidechain graphene_chain graphene_app fc zmq )
|
||||||
target_include_directories( peerplays_sidechain
|
target_include_directories( peerplays_sidechain
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,10 @@ void peerplays_sidechain_plugin_impl::plugin_initialize(const boost::program_opt
|
||||||
boost::insert(sons, fc::json::from_string(options.at("son-ids").as<string>()).as<vector<chain::son_id_type>>(5));
|
boost::insert(sons, fc::json::from_string(options.at("son-ids").as<string>()).as<vector<chain::son_id_type>>(5));
|
||||||
config_ready_son = config_ready_son && !sons.empty();
|
config_ready_son = config_ready_son && !sons.empty();
|
||||||
|
|
||||||
#ifndef SUPPORT_MULTIPLE_SONS
|
#ifndef ENABLE_DEV_FEATURES
|
||||||
FC_ASSERT(sons.size() == 1, "Multiple SONs not supported");
|
if (sons.size() > 1) {
|
||||||
|
FC_THROW("Invalid configuration, multiple SON IDs provided");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (options.count("peerplays-private-key")) {
|
if (options.count("peerplays-private-key")) {
|
||||||
|
|
|
||||||
|
|
@ -151,8 +151,18 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
||||||
fc::to_string(btc_asset_id.type_id) + "." +
|
fc::to_string(btc_asset_id.type_id) + "." +
|
||||||
fc::to_string((uint64_t)btc_asset_id.instance);
|
fc::to_string((uint64_t)btc_asset_id.instance);
|
||||||
|
|
||||||
|
#ifdef ENABLE_DEV_FEATURES
|
||||||
|
// Accepts BTC and peerplays asset deposits
|
||||||
|
bool deposit_condition = ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare(btc_asset_id_str) != 0));
|
||||||
|
bool withdraw_condition = ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare(btc_asset_id_str) == 0));
|
||||||
|
#else
|
||||||
|
// Accepts BTC deposits only
|
||||||
|
bool deposit_condition = ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare("BTC") == 0));
|
||||||
|
bool withdraw_condition = ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare(btc_asset_id_str) == 0));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Deposit request
|
// Deposit request
|
||||||
if ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare(btc_asset_id_str) != 0)) {
|
if (deposit_condition) {
|
||||||
|
|
||||||
for (son_id_type son_id : plugin.get_sons()) {
|
for (son_id_type son_id : plugin.get_sons()) {
|
||||||
if (plugin.is_active_son(son_id)) {
|
if (plugin.is_active_son(son_id)) {
|
||||||
|
|
@ -187,7 +197,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
||||||
}
|
}
|
||||||
|
|
||||||
// Withdrawal request
|
// Withdrawal request
|
||||||
if ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare(btc_asset_id_str) == 0)) {
|
if (withdraw_condition) {
|
||||||
// BTC Payout only (for now)
|
// BTC Payout only (for now)
|
||||||
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_account_and_sidechain>();
|
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_account_and_sidechain>();
|
||||||
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sed.peerplays_from, sidechain_type::bitcoin));
|
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sed.peerplays_from, sidechain_type::bitcoin));
|
||||||
|
|
@ -226,8 +236,6 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FC_ASSERT(false, "Invalid sidechain event");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sidechain_net_handler::process_proposals() {
|
void sidechain_net_handler::process_proposals() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue