Remove as much warnings from build log as possible (#400)
* Remove as much warnings from build log as possible
This commit is contained in:
parent
74764b946d
commit
cb786554fc
40 changed files with 123 additions and 159 deletions
|
|
@ -156,7 +156,7 @@ else( WIN32 ) # Apple AND Linux
|
|||
endif( APPLE )
|
||||
|
||||
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-memcmp -Wno-parentheses -Wno-terminate -Wno-invalid-offsetof -Wno-sign-compare" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
||||
if( CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0.0 )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization" )
|
||||
|
|
|
|||
|
|
@ -380,7 +380,6 @@ namespace detail {
|
|||
_chain_db->enable_standby_votes_tracking( _options->at("enable-standby-votes-tracking").as<bool>() );
|
||||
}
|
||||
|
||||
bool replay = false;
|
||||
std::string replay_reason = "reason not provided";
|
||||
|
||||
if( _options->count("replay-blockchain") )
|
||||
|
|
|
|||
|
|
@ -2570,18 +2570,8 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type
|
|||
|
||||
share_type total_amount;
|
||||
auto balance_type = vesting_balance_type::gpos;
|
||||
#ifdef USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
auto vesting_balances_begin =
|
||||
vesting_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(asset_id_type(), balance_type));
|
||||
auto vesting_balances_end =
|
||||
vesting_index.indices().get<by_asset_balance>().upper_bound(boost::make_tuple(asset_id_type(), balance_type, share_type()));
|
||||
|
||||
for (const vesting_balance_object& vesting_balance_obj : boost::make_iterator_range(vesting_balances_begin, vesting_balances_end))
|
||||
{
|
||||
total_amount += vesting_balance_obj.balance.amount;
|
||||
}
|
||||
#else
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
const vesting_balance_index& vesting_index = _db.get_index_type<vesting_balance_index>();
|
||||
const auto& vesting_balances = vesting_index.indices().get<by_id>();
|
||||
for (const vesting_balance_object& vesting_balance_obj : vesting_balances)
|
||||
|
|
@ -2591,7 +2581,6 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type
|
|||
total_amount += vesting_balance_obj.balance.amount;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vector<vesting_balance_object> account_vbos;
|
||||
const time_point_sec now = _db.head_block_time();
|
||||
|
|
|
|||
|
|
@ -596,7 +596,6 @@ void_result asset_update_dividend_evaluator::do_apply( const asset_update_divide
|
|||
obj.referrer = op.issuer;
|
||||
obj.lifetime_referrer = op.issuer(db()).lifetime_referrer;
|
||||
|
||||
auto& params = db().get_global_properties().parameters;
|
||||
obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
obj.lifetime_referrer_fee_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
obj.referrer_rewards_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ map< account_id_type, vector< uint16_t > > asset_object::distribute_winners_part
|
|||
*t += percents_to_distribute / holders.size();
|
||||
}
|
||||
auto sweeps_distribution_percentage = db.get_global_properties().parameters.sweeps_distribution_percentage();
|
||||
for( int c = 0; c < winner_numbers.size(); ++c ) {
|
||||
for( size_t c = 0; c < winner_numbers.size(); ++c ) {
|
||||
auto winner_num = winner_numbers[c];
|
||||
lottery_reward_operation reward_op;
|
||||
reward_op.lottery = get_id();
|
||||
|
|
|
|||
|
|
@ -140,8 +140,10 @@ void database::adjust_sweeps_vesting_balance(account_id_type account, int64_t de
|
|||
b.balance = delta;
|
||||
});
|
||||
} else {
|
||||
if( delta < 0 )
|
||||
FC_ASSERT( itr->get_balance() >= -delta, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",account)("b",itr->get_balance())("r",-delta));
|
||||
if( delta < 0 ) {
|
||||
uint64_t delta_uint64 = -delta;
|
||||
FC_ASSERT( itr->get_balance() >= delta_uint64, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",account)("b",itr->get_balance())("r",-delta));
|
||||
}
|
||||
modify(*itr, [&delta,&asset_id,this](sweeps_vesting_balance_object& b) {
|
||||
b.adjust_balance( asset( delta, asset_id ) );
|
||||
b.last_claim_date = head_block_time();
|
||||
|
|
|
|||
|
|
@ -303,8 +303,6 @@ void database::settle_betting_market_group(const betting_market_group_object& be
|
|||
remove(betting_market);
|
||||
}
|
||||
|
||||
const event_object& event = betting_market_group.event_id(*this);
|
||||
|
||||
fc_dlog(fc::logger::get("betting"), "removing betting market group ${id}", ("id", betting_market_group.id));
|
||||
remove(betting_market_group);
|
||||
|
||||
|
|
@ -537,11 +535,9 @@ int match_bet(database& db, const bet_object& taker_bet, const bet_object& maker
|
|||
// because we matched at the maker's odds and not the taker's odds, the remaining amount to match
|
||||
// may not be an even multiple of the taker's odds; round it down.
|
||||
share_type taker_remaining_factor = unrounded_taker_remaining_amount_to_match / takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_maker_amount_to_match = taker_remaining_factor * takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_bet_amount = taker_remaining_factor * takers_odds_taker_odds_ratio;
|
||||
|
||||
taker_refund_amount = taker_bet.amount_to_bet.amount - taker_amount_to_match - taker_remaining_bet_amount;
|
||||
//idump((taker_remaining_factor)(taker_remaining_maker_amount_to_match)(taker_remaining_bet_amount)(taker_refund_amount));
|
||||
}
|
||||
|
||||
if (taker_refund_amount > share_type())
|
||||
|
|
|
|||
|
|
@ -933,7 +933,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
|
||||
const auto& idx = get_index_type<asset_index>().indices().get<by_symbol>();
|
||||
auto it = idx.begin();
|
||||
bool has_imbalanced_assets = false;
|
||||
|
||||
while( it != idx.end() )
|
||||
{
|
||||
|
|
@ -945,7 +944,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
FC_ASSERT( debt_itr != total_debts.end() );
|
||||
if( supply_itr->second != debt_itr->second )
|
||||
{
|
||||
has_imbalanced_assets = true;
|
||||
elog( "Genesis for asset ${aname} is not balanced\n"
|
||||
" Debt is ${debt}\n"
|
||||
" Supply is ${supply}\n",
|
||||
|
|
@ -957,10 +955,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
}
|
||||
++it;
|
||||
}
|
||||
// @romek
|
||||
#if 0
|
||||
FC_ASSERT( !has_imbalanced_assets );
|
||||
#endif
|
||||
|
||||
// Save tallied supplies
|
||||
for( const auto& item : total_supplies )
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@
|
|||
#include <graphene/chain/witness_schedule_object.hpp>
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
|
||||
#define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
template<class Index>
|
||||
|
|
@ -1192,7 +1190,6 @@ uint32_t database::get_gpos_current_subperiod()
|
|||
const auto period_start = fc::time_point_sec(gpo.parameters.gpos_period_start());
|
||||
|
||||
// variables needed
|
||||
const fc::time_point_sec period_end = period_start + vesting_period;
|
||||
const auto number_of_subperiods = vesting_period / vesting_subperiod;
|
||||
const auto now = this->head_block_time();
|
||||
auto seconds_since_period_start = now.sec_since_epoch() - period_start.sec_since_epoch();
|
||||
|
|
@ -1385,7 +1382,6 @@ void schedule_pending_dividend_balances(database& db,
|
|||
|
||||
uint32_t holder_account_count = 0;
|
||||
|
||||
#ifdef USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
auto vesting_balances_begin =
|
||||
vesting_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(dividend_holder_asset_obj.id, balance_type));
|
||||
|
|
@ -1400,22 +1396,6 @@ void schedule_pending_dividend_balances(database& db,
|
|||
("owner", vesting_balance_obj.owner(db).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
#else
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
const auto& vesting_balances = vesting_index.indices().get<by_id>();
|
||||
for (const vesting_balance_object& vesting_balance_obj : vesting_balances)
|
||||
{
|
||||
if (vesting_balance_obj.balance.asset_id == dividend_holder_asset_obj.id && vesting_balance_obj.balance.amount &&
|
||||
vesting_balance_object.balance_type == balance_type)
|
||||
{
|
||||
vesting_amounts[vesting_balance_obj.owner] += vesting_balance_obj.balance.amount;
|
||||
++gpos_holder_account_count;
|
||||
dlog("Vesting balance for account: ${owner}, amount: ${amount}",
|
||||
("owner", vesting_balance_obj.owner(db).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
auto current_distribution_account_balance_iter = current_distribution_account_balance_range.begin();
|
||||
if(db.head_block_time() < HARDFORK_GPOS_TIME)
|
||||
|
|
@ -1869,7 +1849,6 @@ void process_dividend_assets(database& db)
|
|||
{
|
||||
// if there was a previous payout, make our next payment one interval
|
||||
uint32_t current_time_sec = current_head_block_time.sec_since_epoch();
|
||||
fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time;
|
||||
uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch();
|
||||
do
|
||||
next_possible_time_sec += *dividend_data_obj.options.payout_interval;
|
||||
|
|
@ -1990,7 +1969,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
balance_type = vesting_balance_type::gpos;
|
||||
|
||||
const vesting_balance_index& vesting_index = d.get_index_type<vesting_balance_index>();
|
||||
#ifdef USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX
|
||||
|
||||
auto vesting_balances_begin =
|
||||
vesting_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(asset_id_type(), balance_type));
|
||||
auto vesting_balances_end =
|
||||
|
|
@ -2002,19 +1981,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
("owner", vesting_balance_obj.owner(d).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
#else
|
||||
const auto& vesting_balances = vesting_index.indices().get<by_id>();
|
||||
for (const vesting_balance_object& vesting_balance_obj : vesting_balances)
|
||||
{
|
||||
if (vesting_balance_obj.balance.asset_id == asset_id_type() && vesting_balance_obj.balance.amount && vesting_balance_obj.balance_type == balance_type)
|
||||
{
|
||||
vesting_amounts[vesting_balance_obj.owner] += vesting_balance_obj.balance.amount;
|
||||
dlog("Vesting balance for account: ${owner}, amount: ${amount}",
|
||||
("owner", vesting_balance_obj.owner(d).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void operator()( const account_object& stake_account, const account_statistics_object& stats )
|
||||
|
|
|
|||
|
|
@ -533,6 +533,9 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
|||
} case sidechain_transaction_object_type:{
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( obj->id.space() == implementation_ids )
|
||||
|
|
@ -587,6 +590,8 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
|||
break;
|
||||
case impl_fba_accumulator_object_type:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end get_relevant_accounts( const object* obj, flat_set<account_id_type>& accounts )
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ namespace graphene { namespace chain {
|
|||
void database::update_global_dynamic_data( const signed_block& b, const uint32_t missed_blocks )
|
||||
{
|
||||
const dynamic_global_property_object& _dgp = get_dynamic_global_properties();
|
||||
const global_property_object& gpo = get_global_properties();
|
||||
|
||||
// dynamic global properties updating
|
||||
modify( _dgp, [&b,this,missed_blocks]( dynamic_global_property_object& dgp ){
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class global_betting_statistics_object : public graphene::db::abstract_object< g
|
|||
static const uint8_t space_id = implementation_ids;
|
||||
static const uint8_t type_id = impl_global_betting_statistics_object_type;
|
||||
|
||||
uint32_t number_of_active_events;
|
||||
uint32_t number_of_active_events = 0;
|
||||
map<asset_id_type, share_type> total_amount_staked;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace graphene { namespace chain {
|
|||
static const uint8_t space_id = protocol_ids;
|
||||
static const uint8_t type_id = sidechain_transaction_object_type;
|
||||
|
||||
sidechain_type sidechain;
|
||||
sidechain_type sidechain = sidechain_type::unknown;
|
||||
object_id_type object_id;
|
||||
std::string transaction;
|
||||
std::vector<son_info> signers;
|
||||
|
|
@ -37,7 +37,7 @@ namespace graphene { namespace chain {
|
|||
uint32_t current_weight = 0;
|
||||
uint32_t threshold = 0;
|
||||
|
||||
sidechain_transaction_status status;
|
||||
sidechain_transaction_status status = sidechain_transaction_status::invalid;
|
||||
};
|
||||
|
||||
struct by_object_id;
|
||||
|
|
|
|||
|
|
@ -200,6 +200,20 @@ namespace graphene { namespace chain {
|
|||
*/
|
||||
struct by_account;
|
||||
struct by_asset_balance;
|
||||
|
||||
struct by_asset_balance_helper_asset_id {
|
||||
typedef asset_id_type result_type;
|
||||
result_type operator()(const vesting_balance_object& vbo) const {
|
||||
return vbo.balance.asset_id;
|
||||
}
|
||||
};
|
||||
struct by_asset_balance_helper_asset_amount {
|
||||
typedef share_type result_type;
|
||||
result_type operator()(const vesting_balance_object& vbo) const {
|
||||
return vbo.balance.amount;
|
||||
}
|
||||
};
|
||||
|
||||
typedef multi_index_container<
|
||||
vesting_balance_object,
|
||||
indexed_by<
|
||||
|
|
@ -210,11 +224,9 @@ namespace graphene { namespace chain {
|
|||
ordered_non_unique< tag<by_asset_balance>,
|
||||
composite_key<
|
||||
vesting_balance_object,
|
||||
member_offset<vesting_balance_object, asset_id_type, (size_t) (offsetof(vesting_balance_object,balance) + offsetof(asset,asset_id))>,
|
||||
by_asset_balance_helper_asset_id,
|
||||
member<vesting_balance_object, vesting_balance_type, &vesting_balance_object::balance_type>,
|
||||
member_offset<vesting_balance_object, share_type, (size_t) (offsetof(vesting_balance_object,balance) + offsetof(asset,amount))>
|
||||
//member<vesting_balance_object, account_id_type, &vesting_balance_object::owner>
|
||||
//member_offset<vesting_balance_object, account_id_type, (size_t) (offsetof(vesting_balance_object,owner))>
|
||||
by_asset_balance_helper_asset_amount
|
||||
>,
|
||||
composite_key_compare<
|
||||
std::less< asset_id_type >,
|
||||
|
|
|
|||
|
|
@ -605,8 +605,9 @@ namespace graphene { namespace chain {
|
|||
return;
|
||||
|
||||
// We shouldn't be here if the final match is complete
|
||||
assert(last_complete_round != num_rounds - 1);
|
||||
if (last_complete_round == num_rounds - 1)
|
||||
uint32_t last_complete_round_uint32 = last_complete_round;
|
||||
assert(last_complete_round_uint32 != num_rounds - 1);
|
||||
if (last_complete_round_uint32 == num_rounds - 1)
|
||||
return;
|
||||
|
||||
if (first_incomplete_match_was_waiting)
|
||||
|
|
|
|||
|
|
@ -59,17 +59,7 @@ namespace graphene { namespace db {
|
|||
{
|
||||
mv._apply_undo = false;
|
||||
}
|
||||
~session() {
|
||||
try {
|
||||
if( _apply_undo ) _db.undo();
|
||||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
elog( "${e}", ("e",e.to_detail_string() ) );
|
||||
throw; // maybe crash..
|
||||
}
|
||||
if( _disable_on_exit ) _db.disable();
|
||||
}
|
||||
~session();
|
||||
void commit() { _apply_undo = false; _db.commit(); }
|
||||
void undo() { if( _apply_undo ) _db.undo(); _apply_undo = false; }
|
||||
void merge() { if( _apply_undo ) _db.merge(); _apply_undo = false; }
|
||||
|
|
|
|||
|
|
@ -30,6 +30,18 @@ namespace graphene { namespace db {
|
|||
void undo_database::enable() { _disabled = false; }
|
||||
void undo_database::disable() { _disabled = true; }
|
||||
|
||||
undo_database::session::~session() {
|
||||
try {
|
||||
if( _apply_undo ) _db.undo();
|
||||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
elog( "${e}", ("e",e.to_detail_string() ) );
|
||||
std::terminate();
|
||||
}
|
||||
if( _disable_on_exit ) _db.disable();
|
||||
}
|
||||
|
||||
undo_database::session undo_database::start_undo_session( bool force_enable )
|
||||
{
|
||||
if( _disabled && !force_enable ) return session(*this);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0e9259486cb04a90ec709750143cc5be1da474ff
|
||||
Subproject commit 29d2f72b24c339cfb8627f24eb1d3486f057188c
|
||||
|
|
@ -2375,6 +2375,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
VERIFY_CORRECT_THREAD();
|
||||
item_hash_t reference_point = peer->last_block_delegate_has_seen;
|
||||
uint32_t reference_point_block_num = _delegate->get_block_number(peer->last_block_delegate_has_seen);
|
||||
(void)reference_point_block_num;
|
||||
|
||||
// when we call _delegate->get_blockchain_synopsis(), we may yield and there's a
|
||||
// chance this peer's state will change before we get control back. Save off
|
||||
|
|
@ -3414,6 +3415,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
for (const item_hash_t& transaction_message_hash : contained_transaction_message_ids)
|
||||
{
|
||||
size_t items_erased = _items_to_fetch.get<item_id_index>().erase(item_id(trx_message_type, transaction_message_hash));
|
||||
(void)items_erased;
|
||||
// there are two ways we could behave here: we could either act as if we received
|
||||
// the transaction outside the block and offer it to our peers, or we could just
|
||||
// forget about it (we would still advertise this block to our peers so they should
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_script.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/serialize.hpp>
|
||||
#include <fc/io/raw.hpp>
|
||||
|
||||
namespace graphene { namespace peerplays_sidechain { namespace bitcoin {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <fc/crypto/base58.hpp>
|
||||
#include <fc/io/raw.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_script.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_transaction.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/serialize.hpp>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#include <graphene/peerplays_sidechain/bitcoin/serialize.hpp>
|
||||
|
||||
#include <fc/io/raw.hpp>
|
||||
|
||||
#include <graphene/peerplays_sidechain/bitcoin/sign_bitcoin_transaction.hpp>
|
||||
|
||||
namespace graphene { namespace peerplays_sidechain { namespace bitcoin {
|
||||
|
|
|
|||
|
|
@ -138,8 +138,10 @@ void peerplays_sidechain_plugin_impl::plugin_initialize(const boost::program_opt
|
|||
config_ready_son = (options.count("son-id") || options.count("son-ids")) && options.count("peerplays-private-key");
|
||||
if (config_ready_son) {
|
||||
LOAD_VALUE_SET(options, "son-id", sons, chain::son_id_type)
|
||||
if (options.count("son-ids"))
|
||||
boost::insert(sons, fc::json::from_string(options.at("son-ids").as<string>()).as<vector<chain::son_id_type>>(5));
|
||||
if (options.count("son-ids")) {
|
||||
vector<chain::son_id_type> v = fc::json::from_string(options.at("son-ids").as<string>()).as<vector<chain::son_id_type>>(5);
|
||||
sons.insert(v.begin(), v.end());
|
||||
}
|
||||
config_ready_son = config_ready_son && !sons.empty();
|
||||
|
||||
#ifndef ENABLE_MULTIPLE_SONS
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ void sidechain_net_handler::process_proposals() {
|
|||
|
||||
int32_t op_idx_1 = -1;
|
||||
chain::operation op_obj_idx_1;
|
||||
(void) op_idx_1;
|
||||
|
||||
if (po->proposed_transaction.operations.size() >= 2) {
|
||||
op_idx_1 = po->proposed_transaction.operations[1].which();
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,7 @@ bool sidechain_net_handler_bitcoin::process_proposal(const proposal_object &po)
|
|||
|
||||
int32_t op_idx_1 = -1;
|
||||
chain::operation op_obj_idx_1;
|
||||
(void) op_idx_1;
|
||||
|
||||
if (po.proposed_transaction.operations.size() >= 2) {
|
||||
op_idx_1 = po.proposed_transaction.operations[1].which();
|
||||
|
|
@ -1107,8 +1108,8 @@ bool sidechain_net_handler_bitcoin::process_proposal(const proposal_object &po)
|
|||
std::string tx_txid = tx_json.get<std::string>("result.txid");
|
||||
uint32_t tx_confirmations = tx_json.get<uint32_t>("result.confirmations");
|
||||
std::string tx_address = "";
|
||||
int64_t tx_amount = -1;
|
||||
int64_t tx_vout = -1;
|
||||
uint64_t tx_amount = -1;
|
||||
uint64_t tx_vout = -1;
|
||||
|
||||
for (auto &input : tx_json.get_child("result.vout")) {
|
||||
std::string tx_vout_s = input.second.get<std::string>("n");
|
||||
|
|
@ -1349,6 +1350,7 @@ void sidechain_net_handler_bitcoin::process_sidechain_addresses() {
|
|||
const auto &sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain);
|
||||
std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second,
|
||||
[&](const sidechain_address_object &sao) {
|
||||
bool retval = true;
|
||||
if (sao.expires == time_point_sec::maximum()) {
|
||||
auto usr_pubkey = fc::ecc::public_key(create_public_key_data(parse_hex(sao.deposit_public_key)));
|
||||
|
||||
|
|
@ -1374,13 +1376,14 @@ void sidechain_net_handler_bitcoin::process_sidechain_addresses() {
|
|||
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
||||
if (plugin.app().p2p_node())
|
||||
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
||||
return true;
|
||||
retval = true;
|
||||
} catch (fc::exception &e) {
|
||||
elog("Sending proposal for deposit sidechain transaction create operation failed with exception ${e}", ("e", e.what()));
|
||||
return false;
|
||||
retval = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1658,11 +1661,11 @@ std::string sidechain_net_handler_bitcoin::create_withdrawal_transaction(const s
|
|||
std::string pw_address = json.get<std::string>("address");
|
||||
std::string redeem_script = json.get<std::string>("redeemScript");
|
||||
|
||||
uint64_t fee_rate = bitcoin_client->estimatesmartfee();
|
||||
uint64_t min_fee_rate = 1000;
|
||||
int64_t fee_rate = bitcoin_client->estimatesmartfee();
|
||||
int64_t min_fee_rate = 1000;
|
||||
fee_rate = std::max(fee_rate, min_fee_rate);
|
||||
|
||||
uint64_t total_amount = 0;
|
||||
int64_t total_amount = 0;
|
||||
std::vector<btc_txout> inputs = bitcoin_client->listunspent_by_address_and_amount(pw_address, 0);
|
||||
|
||||
if (inputs.size() == 0) {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ void sidechain_net_handler_peerplays::process_sidechain_addresses() {
|
|||
const auto &sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain);
|
||||
std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second,
|
||||
[&](const sidechain_address_object &sao) {
|
||||
bool retval = true;
|
||||
if (sao.expires == time_point_sec::maximum()) {
|
||||
if (sao.deposit_address == "") {
|
||||
sidechain_address_update_operation op;
|
||||
|
|
@ -150,13 +151,14 @@ void sidechain_net_handler_peerplays::process_sidechain_addresses() {
|
|||
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
||||
if (plugin.app().p2p_node())
|
||||
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
||||
return true;
|
||||
retval = true;
|
||||
} catch (fc::exception &e) {
|
||||
elog("Sending transaction for update deposit address operation failed with exception ${e}", ("e", e.what()));
|
||||
return false;
|
||||
retval = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,10 @@ void witness_plugin::plugin_initialize(const boost::program_options::variables_m
|
|||
ilog("witness plugin: plugin_initialize() begin");
|
||||
_options = &options;
|
||||
LOAD_VALUE_SET(options, "witness-id", _witnesses, chain::witness_id_type)
|
||||
if (options.count("witness-ids"))
|
||||
boost::insert(_witnesses, fc::json::from_string(options.at("witness-ids").as<string>()).as<vector<chain::witness_id_type>>( 5 ));
|
||||
if (options.count("witness-ids")) {
|
||||
vector<chain::witness_id_type> v = fc::json::from_string(options.at("witness-ids").as<string>()).as<vector<chain::witness_id_type>>( 5 );
|
||||
_witnesses.insert(v.begin(), v.end());
|
||||
}
|
||||
|
||||
if( options.count("private-key") )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,20 +203,28 @@ database_fixture::database_fixture()
|
|||
}
|
||||
|
||||
database_fixture::~database_fixture()
|
||||
{ try {
|
||||
// If we're unwinding due to an exception, don't do any more checks.
|
||||
// This way, boost test's last checkpoint tells us approximately where the error was.
|
||||
if( !std::uncaught_exception() )
|
||||
{
|
||||
verify_asset_supplies(db);
|
||||
verify_account_history_plugin_index();
|
||||
BOOST_CHECK( db.get_node_properties().skip_flags == database::skip_nothing );
|
||||
}
|
||||
{
|
||||
try {
|
||||
// If we're unwinding due to an exception, don't do any more checks.
|
||||
// This way, boost test's last checkpoint tells us approximately where the error was.
|
||||
if( !std::uncaught_exception() )
|
||||
{
|
||||
verify_asset_supplies(db);
|
||||
verify_account_history_plugin_index();
|
||||
BOOST_CHECK( db.get_node_properties().skip_flags == database::skip_nothing );
|
||||
}
|
||||
|
||||
if( data_dir )
|
||||
db.close();
|
||||
return;
|
||||
} FC_CAPTURE_AND_RETHROW() }
|
||||
if( data_dir )
|
||||
db.close();
|
||||
return;
|
||||
} catch (fc::exception& ex) {
|
||||
BOOST_FAIL( std::string("fc::exception in ~database_fixture: ") + ex.to_detail_string() );
|
||||
} catch (std::exception& e) {
|
||||
BOOST_FAIL( std::string("std::exception in ~database_fixture:") + e.what() );
|
||||
} catch (...) {
|
||||
BOOST_FAIL( "Uncaught exception in ~database_fixture" );
|
||||
}
|
||||
}
|
||||
|
||||
fc::ecc::private_key database_fixture::generate_private_key(string seed)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,7 +127,9 @@ extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP;
|
|||
|
||||
#define PREP_ACTOR(name) \
|
||||
fc::ecc::private_key name ## _private_key = generate_private_key(BOOST_PP_STRINGIZE(name)); \
|
||||
public_key_type name ## _public_key = name ## _private_key.get_public_key();
|
||||
public_key_type name ## _public_key = name ## _private_key.get_public_key(); \
|
||||
(void) name ## _private_key; \
|
||||
(void) name ## _public_key;
|
||||
|
||||
#define ACTOR(name) \
|
||||
PREP_ACTOR(name) \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <boost/test/unit_test.hpp>
|
||||
#include <fc/io/raw.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_transaction.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/serialize.hpp>
|
||||
#include <graphene/peerplays_sidechain/bitcoin/utils.hpp>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ genesis_state_type make_genesis() {
|
|||
|
||||
auto init_account_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
|
||||
genesis_state.initial_active_witnesses = 10;
|
||||
for( int i = 0; i < genesis_state.initial_active_witnesses; ++i )
|
||||
for( uint64_t i = 0; i < genesis_state.initial_active_witnesses; ++i )
|
||||
{
|
||||
auto name = "init"+fc::to_string(i);
|
||||
genesis_state.initial_accounts.emplace_back(name,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ BOOST_AUTO_TEST_CASE( confidential_test )
|
|||
|
||||
auto InB1 = fc::sha256::hash("InB1");
|
||||
auto InB2 = fc::sha256::hash("InB2");
|
||||
auto OutB = fc::sha256::hash("InB2");
|
||||
auto nonce1 = fc::sha256::hash("nonce");
|
||||
auto nonce2 = fc::sha256::hash("nonce2");
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE( merge_test )
|
|||
try {
|
||||
database db;
|
||||
auto ses = db._undo_db.start_undo_session();
|
||||
const auto& bal_obj1 = db.create<account_balance_object>( [&]( account_balance_object& obj ){
|
||||
db.create<account_balance_object>( [&]( account_balance_object& obj ){
|
||||
obj.balance = 42;
|
||||
});
|
||||
ses.merge();
|
||||
|
|
|
|||
|
|
@ -219,8 +219,6 @@ BOOST_AUTO_TEST_CASE( test_basic_dividend_distribution )
|
|||
const account_object& alice = get_account("alice");
|
||||
const account_object& bob = get_account("bob");
|
||||
const account_object& carol = get_account("carol");
|
||||
const account_object& dave = get_account("dave");
|
||||
const account_object& frank = get_account("frank");
|
||||
const auto& test_asset_object = get_asset("TESTB");
|
||||
|
||||
auto issue_asset_to_account = [&](const asset_object& asset_to_issue, const account_object& destination_account, int64_t amount_to_issue)
|
||||
|
|
@ -379,7 +377,6 @@ BOOST_AUTO_TEST_CASE( test_basic_dividend_distribution_to_core_asset )
|
|||
const account_object& bob = get_account("bob");
|
||||
const account_object& carol = get_account("carol");
|
||||
const account_object& dave = get_account("dave");
|
||||
const account_object& frank = get_account("frank");
|
||||
const auto& test_asset_object = get_asset("TESTB");
|
||||
|
||||
auto issue_asset_to_account = [&](const asset_object& asset_to_issue, const account_object& destination_account, int64_t amount_to_issue)
|
||||
|
|
@ -513,28 +510,6 @@ BOOST_AUTO_TEST_CASE( test_basic_dividend_distribution_to_core_asset )
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_dividend_distribution_interval )
|
||||
{
|
||||
using namespace graphene;
|
||||
try {
|
||||
INVOKE( create_dividend_uia );
|
||||
|
||||
const auto& dividend_holder_asset_object = get_asset("DIVIDEND");
|
||||
const auto& dividend_data = dividend_holder_asset_object.dividend_data(db);
|
||||
const account_object& dividend_distribution_account = dividend_data.dividend_distribution_account(db);
|
||||
const account_object& alice = get_account("alice");
|
||||
const account_object& bob = get_account("bob");
|
||||
const account_object& carol = get_account("carol");
|
||||
const account_object& dave = get_account("dave");
|
||||
const account_object& frank = get_account("frank");
|
||||
const auto& test_asset_object = get_asset("TESTB");
|
||||
} catch(fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( check_dividend_corner_cases )
|
||||
{
|
||||
using namespace graphene;
|
||||
|
|
@ -547,8 +522,6 @@ BOOST_AUTO_TEST_CASE( check_dividend_corner_cases )
|
|||
const account_object& alice = get_account("alice");
|
||||
const account_object& bob = get_account("bob");
|
||||
const account_object& carol = get_account("carol");
|
||||
const account_object& dave = get_account("dave");
|
||||
const account_object& frank = get_account("frank");
|
||||
const auto& test_asset_object = get_asset("TESTB");
|
||||
|
||||
auto issue_asset_to_account = [&](const asset_object& asset_to_issue, const account_object& destination_account, int64_t amount_to_issue)
|
||||
|
|
@ -570,16 +543,6 @@ BOOST_AUTO_TEST_CASE( check_dividend_corner_cases )
|
|||
BOOST_CHECK_EQUAL(pending_balance, expected_balance);
|
||||
};
|
||||
|
||||
auto reserve_asset_from_account = [&](const asset_object& asset_to_reserve, const account_object& from_account, int64_t amount_to_reserve)
|
||||
{
|
||||
asset_reserve_operation reserve_op;
|
||||
reserve_op.payer = from_account.id;
|
||||
reserve_op.amount_to_reserve = asset(amount_to_reserve, asset_to_reserve.id);
|
||||
trx.operations.push_back(reserve_op);
|
||||
set_expiration(db, trx);
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
trx.operations.clear();
|
||||
};
|
||||
auto advance_to_next_payout_time = [&]() {
|
||||
// Advance to the next upcoming payout time
|
||||
BOOST_REQUIRE(dividend_data.options.next_payout_time);
|
||||
|
|
|
|||
|
|
@ -546,7 +546,6 @@ BOOST_AUTO_TEST_CASE( votes_on_gpos_activation )
|
|||
generate_block();
|
||||
|
||||
// update default gpos
|
||||
auto now = db.head_block_time();
|
||||
// 5184000 = 60x60x24x6 = 6 days
|
||||
// 864000 = 60x60x24x1 = 1 days
|
||||
update_gpos_global(518400, 86400, HARDFORK_GPOS_TIME);
|
||||
|
|
|
|||
|
|
@ -415,6 +415,8 @@ BOOST_AUTO_TEST_CASE(track_account) {
|
|||
// account_id_type() creates alice(not tracked account)
|
||||
const account_object& alice = create_account("alice");
|
||||
auto alice_id = alice.id;
|
||||
(void)alice;
|
||||
(void)alice_id;
|
||||
|
||||
//account_id_type() creates some ops
|
||||
create_bitasset("CNY", account_id_type());
|
||||
|
|
@ -423,6 +425,8 @@ BOOST_AUTO_TEST_CASE(track_account) {
|
|||
// account_id_type() creates dan(account tracked)
|
||||
const account_object& dan = create_account("dan");
|
||||
auto dan_id = dan.id;
|
||||
(void)dan;
|
||||
(void)dan_id;
|
||||
|
||||
// dan makes 1 op
|
||||
create_bitasset("EUR", dan_id);
|
||||
|
|
@ -492,6 +496,8 @@ BOOST_AUTO_TEST_CASE(track_account2) {
|
|||
// account_id_type() creates alice(tracked account)
|
||||
const account_object& alice = create_account("alice");
|
||||
auto alice_id = alice.id;
|
||||
(void)alice;
|
||||
(void)alice_id;
|
||||
|
||||
//account_id_type() creates some ops
|
||||
create_bitasset("CNY", account_id_type());
|
||||
|
|
@ -503,6 +509,8 @@ BOOST_AUTO_TEST_CASE(track_account2) {
|
|||
// account_id_type() creates dan(account not tracked)
|
||||
const account_object& dan = create_account("dan");
|
||||
auto dan_id = dan.id;
|
||||
(void)dan;
|
||||
(void)dan_id;
|
||||
|
||||
generate_block();
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE( lottery_idx_test )
|
|||
while( test_itr != test_asset_idx.end() ) {
|
||||
if( !met_not_active && (!test_itr->is_lottery() || !test_itr->lottery_options->is_active) )
|
||||
met_not_active = true;
|
||||
FC_ASSERT( !met_not_active || met_not_active && (!test_itr->is_lottery() || !test_itr->lottery_options->is_active), "MET ACTIVE LOTTERY AFTER NOT ACTIVE" );
|
||||
FC_ASSERT( (!met_not_active) || (met_not_active && (!test_itr->is_lottery() || !test_itr->lottery_options->is_active)), "MET ACTIVE LOTTERY AFTER NOT ACTIVE" );
|
||||
++test_itr;
|
||||
}
|
||||
} catch (fc::exception& e) {
|
||||
|
|
@ -128,7 +128,8 @@ BOOST_AUTO_TEST_CASE( tickets_purchase_test )
|
|||
trx.operations.clear();
|
||||
|
||||
BOOST_CHECK( tpo.amount == db.get_balance( test_asset.get_id() ) );
|
||||
BOOST_CHECK( tpo.tickets_to_buy == get_balance( account_id_type(), test_asset.id ) );
|
||||
int64_t tickets_to_buy_int64 = tpo.tickets_to_buy;
|
||||
BOOST_CHECK( tickets_to_buy_int64 == get_balance( account_id_type(), test_asset.id ) );
|
||||
|
||||
} catch (fc::exception& e) {
|
||||
edump((e.to_detail_string()));
|
||||
|
|
|
|||
|
|
@ -1561,7 +1561,6 @@ BOOST_AUTO_TEST_CASE( vesting_balance_create_test )
|
|||
op.amount = test_asset.amount( 100 );
|
||||
//op.vesting_seconds = 60*60*24;
|
||||
op.policy = cdd_vesting_policy_initializer{ 60*60*24 };
|
||||
op.balance_type == vesting_balance_type::normal;
|
||||
|
||||
// Fee must be non-negative
|
||||
REQUIRE_OP_VALIDATION_SUCCESS( op, fee, core.amount(1) );
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(last_voting_date_proxy)
|
|||
PUSH_TX( db, trx, ~0 );
|
||||
}
|
||||
// last_vote_time is not updated
|
||||
auto round2 = db.head_block_time().sec_since_epoch();
|
||||
db.head_block_time().sec_since_epoch();
|
||||
alice_stats_obj = alice_id(db).statistics(db);
|
||||
BOOST_CHECK_EQUAL(alice_stats_obj.last_vote_time.sec_since_epoch(), round1);
|
||||
|
||||
|
|
|
|||
|
|
@ -1731,7 +1731,8 @@ BOOST_FIXTURE_TEST_CASE( ties, database_fixture )
|
|||
share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64();
|
||||
optional<account_id_type> dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id);
|
||||
if (dividend_account.valid())
|
||||
players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount;
|
||||
players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount;
|
||||
players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount;
|
||||
|
||||
tournaments.erase(tournament_id);
|
||||
--tournaments_to_complete;
|
||||
|
|
@ -1943,7 +1944,8 @@ BOOST_FIXTURE_TEST_CASE( assets, database_fixture )
|
|||
share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64();
|
||||
optional<account_id_type> dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id);
|
||||
if (dividend_account.valid())
|
||||
players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount;
|
||||
players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount;
|
||||
players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount;
|
||||
|
||||
tournaments.erase(tournament_id);
|
||||
--tournaments_to_complete;
|
||||
|
|
|
|||
Loading…
Reference in a new issue