2017-05-25 09:13:59 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
|
|
|
|
|
*
|
|
|
|
|
* The MIT License
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
* THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
|
|
|
|
|
|
#include <graphene/account_history/account_history_plugin.hpp>
|
|
|
|
|
#include <graphene/market_history/market_history_plugin.hpp>
|
2019-07-30 15:43:31 +00:00
|
|
|
#include <graphene/bookie/bookie_plugin.hpp>
|
|
|
|
|
#include <graphene/bookie/bookie_api.hpp>
|
|
|
|
|
#include <graphene/affiliate_stats/affiliate_stats_plugin.hpp>
|
2020-03-27 17:46:30 +00:00
|
|
|
#include <graphene/elasticsearch/elasticsearch_plugin.hpp>
|
|
|
|
|
#include <graphene/es_objects/es_objects.hpp>
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
#include <graphene/chain/committee_member_object.hpp>
|
|
|
|
|
#include <graphene/chain/fba_object.hpp>
|
|
|
|
|
#include <graphene/chain/market_object.hpp>
|
|
|
|
|
#include <graphene/chain/vesting_balance_object.hpp>
|
|
|
|
|
#include <graphene/chain/witness_object.hpp>
|
2019-07-30 15:43:31 +00:00
|
|
|
#include <graphene/chain/betting_market_object.hpp>
|
|
|
|
|
#include <graphene/chain/proposal_object.hpp>
|
|
|
|
|
#include <graphene/chain/sport_object.hpp>
|
|
|
|
|
#include <graphene/chain/event_group_object.hpp>
|
|
|
|
|
#include <graphene/chain/event_object.hpp>
|
2017-05-25 09:13:59 +00:00
|
|
|
#include <graphene/chain/tournament_object.hpp>
|
2020-08-10 13:18:47 +00:00
|
|
|
#include <graphene/chain/offer_object.hpp>
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
#include <graphene/utilities/tempdir.hpp>
|
|
|
|
|
|
|
|
|
|
#include <fc/crypto/digest.hpp>
|
|
|
|
|
|
2020-02-04 18:31:45 +00:00
|
|
|
#include <exception>
|
2017-05-25 09:13:59 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
|
|
#include "database_fixture.hpp"
|
|
|
|
|
|
|
|
|
|
using namespace graphene::chain::test;
|
|
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700002;
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
namespace graphene { namespace chain {
|
|
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
|
using std::cerr;
|
|
|
|
|
|
|
|
|
|
database_fixture::database_fixture()
|
|
|
|
|
: app(), db( *app.chain_database() )
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
int argc = boost::unit_test::framework::master_test_suite().argc;
|
|
|
|
|
char** argv = boost::unit_test::framework::master_test_suite().argv;
|
|
|
|
|
for( int i=1; i<argc; i++ )
|
|
|
|
|
{
|
|
|
|
|
const std::string arg = argv[i];
|
|
|
|
|
if( arg == "--record-assert-trip" )
|
|
|
|
|
fc::enable_record_assert_trip = true;
|
|
|
|
|
if( arg == "--show-test-names" )
|
|
|
|
|
std::cout << "running test " << boost::unit_test::framework::current_test_case().p_name << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 17:46:30 +00:00
|
|
|
//auto ahplugin = app.register_plugin<graphene::account_history::account_history_plugin>();
|
2017-05-25 09:13:59 +00:00
|
|
|
auto mhplugin = app.register_plugin<graphene::market_history::market_history_plugin>();
|
2019-07-30 15:43:31 +00:00
|
|
|
auto bookieplugin = app.register_plugin<graphene::bookie::bookie_plugin>();
|
|
|
|
|
auto affiliateplugin = app.register_plugin<graphene::affiliate_stats::affiliate_stats_plugin>();
|
2017-05-25 09:13:59 +00:00
|
|
|
init_account_pub_key = init_account_priv_key.get_public_key();
|
|
|
|
|
|
|
|
|
|
boost::program_options::variables_map options;
|
|
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
genesis_state.initial_timestamp = time_point_sec( GRAPHENE_TESTING_GENESIS_TIMESTAMP );
|
|
|
|
|
//int back_to_the_past = 0;
|
|
|
|
|
//back_to_the_past = 7 * 24 * 60 * 60; // week
|
|
|
|
|
//genesis_state.initial_timestamp = time_point_sec( (fc::time_point::now().sec_since_epoch() - back_to_the_past) / GRAPHENE_DEFAULT_BLOCK_INTERVAL * GRAPHENE_DEFAULT_BLOCK_INTERVAL );
|
|
|
|
|
genesis_state.initial_parameters.witness_schedule_algorithm = GRAPHENE_WITNESS_SHUFFLED_ALGORITHM;
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
genesis_state.initial_active_witnesses = 10;
|
|
|
|
|
for( unsigned i = 0; i < genesis_state.initial_active_witnesses; ++i )
|
|
|
|
|
{
|
|
|
|
|
auto name = "init"+fc::to_string(i);
|
|
|
|
|
genesis_state.initial_accounts.emplace_back(name,
|
|
|
|
|
init_account_priv_key.get_public_key(),
|
|
|
|
|
init_account_priv_key.get_public_key(),
|
|
|
|
|
true);
|
|
|
|
|
genesis_state.initial_committee_candidates.push_back({name});
|
|
|
|
|
genesis_state.initial_witness_candidates.push_back({name, init_account_priv_key.get_public_key()});
|
|
|
|
|
}
|
|
|
|
|
genesis_state.initial_parameters.current_fees->zero_all_fees();
|
|
|
|
|
open_database();
|
|
|
|
|
|
2019-09-06 13:27:13 +00:00
|
|
|
// add account tracking for ahplugin for special test case with track-account enabled
|
|
|
|
|
if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account") {
|
|
|
|
|
std::vector<std::string> track_account;
|
2020-03-21 08:47:46 +00:00
|
|
|
std::string track = "\"1.2.18\"";
|
2019-09-06 13:27:13 +00:00
|
|
|
track_account.push_back(track);
|
|
|
|
|
options.insert(std::make_pair("track-account", boost::program_options::variable_value(track_account, false)));
|
|
|
|
|
options.insert(std::make_pair("partial-operations", boost::program_options::variable_value(true, false)));
|
|
|
|
|
}
|
|
|
|
|
// account tracking 2 accounts
|
|
|
|
|
if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account2") {
|
|
|
|
|
std::vector<std::string> track_account;
|
|
|
|
|
std::string track = "\"1.2.0\"";
|
|
|
|
|
track_account.push_back(track);
|
2020-03-21 08:47:46 +00:00
|
|
|
track = "\"1.2.17\"";
|
2019-09-06 13:27:13 +00:00
|
|
|
track_account.push_back(track);
|
|
|
|
|
options.insert(std::make_pair("track-account", boost::program_options::variable_value(track_account, false)));
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 17:46:30 +00:00
|
|
|
// standby votes tracking
|
|
|
|
|
if( boost::unit_test::framework::current_test_case().p_name.value == "track_votes_witnesses_disabled" ||
|
|
|
|
|
boost::unit_test::framework::current_test_case().p_name.value == "track_votes_committee_disabled") {
|
|
|
|
|
app.chain_database()->enable_standby_votes_tracking( false );
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-25 09:13:59 +00:00
|
|
|
// app.initialize();
|
2020-03-27 17:46:30 +00:00
|
|
|
|
|
|
|
|
auto test_name = boost::unit_test::framework::current_test_case().p_name.value;
|
|
|
|
|
if(test_name == "elasticsearch_account_history" || test_name == "elasticsearch_suite" ||
|
|
|
|
|
test_name == "elasticsearch_history_api") {
|
|
|
|
|
auto esplugin = app.register_plugin<graphene::elasticsearch::elasticsearch_plugin>();
|
|
|
|
|
esplugin->plugin_set_app(&app);
|
|
|
|
|
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-node-url", boost::program_options::variable_value(string("http://localhost:9200/"), false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-bulk-replay", boost::program_options::variable_value(uint32_t(2), false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-bulk-sync", boost::program_options::variable_value(uint32_t(2), false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-start-es-after-block", boost::program_options::variable_value(uint32_t(0), false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-visitor", boost::program_options::variable_value(false, false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-operation-object", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-operation-string", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("elasticsearch-mode", boost::program_options::variable_value(uint16_t(2), false)));
|
|
|
|
|
|
|
|
|
|
esplugin->plugin_initialize(options);
|
|
|
|
|
esplugin->plugin_startup();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
auto ahplugin = app.register_plugin<graphene::account_history::account_history_plugin>();
|
|
|
|
|
app.enable_plugin("affiliate_stats");
|
|
|
|
|
ahplugin->plugin_set_app(&app);
|
|
|
|
|
ahplugin->plugin_initialize(options);
|
|
|
|
|
ahplugin->plugin_startup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(test_name == "elasticsearch_objects" || test_name == "elasticsearch_suite") {
|
|
|
|
|
auto esobjects_plugin = app.register_plugin<graphene::es_objects::es_objects_plugin>();
|
|
|
|
|
esobjects_plugin->plugin_set_app(&app);
|
|
|
|
|
|
|
|
|
|
options.insert(std::make_pair("es-objects-elasticsearch-url", boost::program_options::variable_value(string("http://localhost:9200/"), false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-bulk-replay", boost::program_options::variable_value(uint32_t(2), false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-bulk-sync", boost::program_options::variable_value(uint32_t(2), false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-proposals", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-accounts", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-assets", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-balances", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-limit-orders", boost::program_options::variable_value(true, false)));
|
|
|
|
|
options.insert(std::make_pair("es-objects-asset-bitasset", boost::program_options::variable_value(true, false)));
|
|
|
|
|
|
|
|
|
|
esobjects_plugin->plugin_initialize(options);
|
|
|
|
|
esobjects_plugin->plugin_startup();
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-25 09:13:59 +00:00
|
|
|
mhplugin->plugin_set_app(&app);
|
|
|
|
|
mhplugin->plugin_initialize(options);
|
2019-07-30 15:43:31 +00:00
|
|
|
bookieplugin->plugin_set_app(&app);
|
|
|
|
|
bookieplugin->plugin_initialize(options);
|
|
|
|
|
affiliateplugin->plugin_set_app(&app);
|
|
|
|
|
affiliateplugin->plugin_initialize(options);
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
mhplugin->plugin_startup();
|
2019-07-30 15:43:31 +00:00
|
|
|
bookieplugin->plugin_startup();
|
|
|
|
|
affiliateplugin->plugin_startup();
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
generate_block();
|
|
|
|
|
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
} catch ( const fc::exception& e )
|
|
|
|
|
{
|
|
|
|
|
edump( (e.to_detail_string()) );
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( data_dir )
|
|
|
|
|
db.close();
|
|
|
|
|
return;
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW() }
|
|
|
|
|
|
|
|
|
|
fc::ecc::private_key database_fixture::generate_private_key(string seed)
|
|
|
|
|
{
|
|
|
|
|
static const fc::ecc::private_key committee = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
|
|
|
|
|
if( seed == "null_key" )
|
|
|
|
|
return committee;
|
|
|
|
|
return fc::ecc::private_key::regenerate(fc::sha256::hash(seed));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string database_fixture::generate_anon_acct_name()
|
|
|
|
|
{
|
|
|
|
|
// names of the form "anon-acct-x123" ; the "x" is necessary
|
|
|
|
|
// to workaround issue #46
|
|
|
|
|
return "anon-acct-x" + std::to_string( anon_acct_count++ );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::verify_asset_supplies( const database& db )
|
|
|
|
|
{
|
|
|
|
|
//wlog("*** Begin asset supply verification ***");
|
|
|
|
|
const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db);
|
|
|
|
|
BOOST_CHECK(core_asset_data.fee_pool == 0);
|
|
|
|
|
|
2020-03-27 17:46:30 +00:00
|
|
|
const auto& statistics_index = db.get_index_type<account_stats_index>().indices();
|
2017-05-25 09:13:59 +00:00
|
|
|
const auto& balance_index = db.get_index_type<account_balance_index>().indices();
|
|
|
|
|
const auto& settle_index = db.get_index_type<force_settlement_index>().indices();
|
|
|
|
|
const auto& tournaments_index = db.get_index_type<tournament_index>().indices();
|
2017-11-13 07:14:07 +00:00
|
|
|
const auto& asst_index = db.get_index_type<asset_index>().indices();
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
map<asset_id_type,share_type> total_balances;
|
|
|
|
|
map<asset_id_type,share_type> total_debts;
|
|
|
|
|
share_type core_in_orders;
|
|
|
|
|
share_type reported_core_in_orders;
|
|
|
|
|
|
|
|
|
|
for( const tournament_object& t : tournaments_index )
|
|
|
|
|
if (t.get_state() != tournament_state::concluded && t.get_state() != tournament_state::registration_period_expired)
|
|
|
|
|
total_balances[t.options.buy_in.asset_id] += t.prize_pool;
|
|
|
|
|
|
2017-11-13 07:14:07 +00:00
|
|
|
for( const asset_object& ai : asst_index)
|
2017-12-06 07:40:52 +00:00
|
|
|
if (ai.is_lottery()) {
|
|
|
|
|
asset balance = db.get_balance( ai.get_id() );
|
|
|
|
|
total_balances[ balance.asset_id ] += balance.amount;
|
|
|
|
|
}
|
2017-05-25 09:13:59 +00:00
|
|
|
for( const account_balance_object& b : balance_index )
|
|
|
|
|
total_balances[b.asset_type] += b.balance;
|
|
|
|
|
for( const force_settlement_object& s : settle_index )
|
|
|
|
|
total_balances[s.balance.asset_id] += s.balance.amount;
|
|
|
|
|
for( const account_statistics_object& a : statistics_index )
|
|
|
|
|
{
|
|
|
|
|
reported_core_in_orders += a.total_core_in_orders;
|
|
|
|
|
total_balances[asset_id_type()] += a.pending_fees + a.pending_vested_fees;
|
|
|
|
|
}
|
|
|
|
|
for( const limit_order_object& o : db.get_index_type<limit_order_index>().indices() )
|
|
|
|
|
{
|
|
|
|
|
asset for_sale = o.amount_for_sale();
|
|
|
|
|
if( for_sale.asset_id == asset_id_type() ) core_in_orders += for_sale.amount;
|
|
|
|
|
total_balances[for_sale.asset_id] += for_sale.amount;
|
|
|
|
|
total_balances[asset_id_type()] += o.deferred_fee;
|
|
|
|
|
}
|
|
|
|
|
for( const call_order_object& o : db.get_index_type<call_order_index>().indices() )
|
|
|
|
|
{
|
|
|
|
|
asset col = o.get_collateral();
|
|
|
|
|
if( col.asset_id == asset_id_type() ) core_in_orders += col.amount;
|
|
|
|
|
total_balances[col.asset_id] += col.amount;
|
|
|
|
|
total_debts[o.get_debt().asset_id] += o.get_debt().amount;
|
|
|
|
|
}
|
|
|
|
|
for( const asset_object& asset_obj : db.get_index_type<asset_index>().indices() )
|
|
|
|
|
{
|
2019-07-30 15:43:31 +00:00
|
|
|
const auto& dasset_obj = asset_obj.dynamic_asset_data_id(db);
|
|
|
|
|
total_balances[asset_obj.id] += dasset_obj.accumulated_fees;
|
|
|
|
|
total_balances[asset_id_type()] += dasset_obj.fee_pool;
|
2017-05-25 09:13:59 +00:00
|
|
|
if( asset_obj.is_market_issued() )
|
|
|
|
|
{
|
|
|
|
|
const auto& bad = asset_obj.bitasset_data(db);
|
|
|
|
|
total_balances[bad.options.short_backing_asset] += bad.settlement_fund;
|
|
|
|
|
}
|
2019-07-30 15:43:31 +00:00
|
|
|
total_balances[asset_obj.id] += dasset_obj.confidential_supply.value;
|
2017-05-25 09:13:59 +00:00
|
|
|
}
|
|
|
|
|
for( const vesting_balance_object& vbo : db.get_index_type< vesting_balance_index >().indices() )
|
|
|
|
|
total_balances[ vbo.balance.asset_id ] += vbo.balance.amount;
|
|
|
|
|
for( const fba_accumulator_object& fba : db.get_index_type< simple_index< fba_accumulator_object > >() )
|
|
|
|
|
total_balances[ asset_id_type() ] += fba.accumulated_fba_fees;
|
2019-07-30 15:43:31 +00:00
|
|
|
|
|
|
|
|
for (const bet_object& o : db.get_index_type<bet_object_index>().indices())
|
|
|
|
|
{
|
|
|
|
|
total_balances[o.amount_to_bet.asset_id] += o.amount_to_bet.amount;
|
|
|
|
|
}
|
|
|
|
|
for (const betting_market_position_object& o : db.get_index_type<betting_market_position_index>().indices())
|
|
|
|
|
{
|
|
|
|
|
const betting_market_object& betting_market = o.betting_market_id(db);
|
|
|
|
|
const betting_market_group_object& betting_market_group = betting_market.group_id(db);
|
|
|
|
|
total_balances[betting_market_group.asset_id] += o.pay_if_canceled;
|
|
|
|
|
total_balances[betting_market_group.asset_id] += o.fees_collected;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 13:18:47 +00:00
|
|
|
for (const offer_object &o : db.get_index_type<offer_index>().indices())
|
|
|
|
|
{
|
|
|
|
|
if (o.buying_item)
|
|
|
|
|
{
|
|
|
|
|
total_balances[o.maximum_price.asset_id] += o.maximum_price.amount;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (o.bid_price)
|
|
|
|
|
{
|
|
|
|
|
total_balances[o.bid_price->asset_id] += o.bid_price->amount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2017-12-06 07:40:52 +00:00
|
|
|
uint64_t sweeps_vestings = 0;
|
|
|
|
|
for( const sweeps_vesting_balance_object& svbo: db.get_index_type< sweeps_vesting_balance_index >().indices() )
|
|
|
|
|
sweeps_vestings += svbo.balance;
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2019-08-02 13:47:32 +00:00
|
|
|
total_balances[db.get_global_properties().parameters.sweeps_distribution_asset()] += sweeps_vestings / SWEEPS_VESTING_BALANCE_MULTIPLIER;
|
2017-05-25 09:13:59 +00:00
|
|
|
total_balances[asset_id_type()] += db.get_dynamic_global_properties().witness_budget;
|
2019-10-17 14:46:48 +00:00
|
|
|
total_balances[asset_id_type()] += db.get_dynamic_global_properties().son_budget;
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
for( const auto& item : total_debts )
|
|
|
|
|
{
|
|
|
|
|
BOOST_CHECK_EQUAL(item.first(db).dynamic_asset_data_id(db).current_supply.value, item.second.value);
|
|
|
|
|
}
|
2019-07-30 15:43:31 +00:00
|
|
|
|
|
|
|
|
for( const asset_object& asset_obj : db.get_index_type<asset_index>().indices() )
|
|
|
|
|
{
|
|
|
|
|
BOOST_CHECK_EQUAL(total_balances[asset_obj.id].value, asset_obj.dynamic_asset_data_id(db).current_supply.value);
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-25 09:13:59 +00:00
|
|
|
BOOST_CHECK_EQUAL( core_in_orders.value , reported_core_in_orders.value );
|
|
|
|
|
// wlog("*** End asset supply verification ***");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::verify_account_history_plugin_index( )const
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
if( skip_key_index_test )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const std::shared_ptr<graphene::account_history::account_history_plugin> pin =
|
|
|
|
|
app.get_plugin<graphene::account_history::account_history_plugin>("account_history");
|
|
|
|
|
if( pin->tracked_accounts().size() == 0 )
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
vector< pair< account_id_type, address > > tuples_from_db;
|
|
|
|
|
const auto& primary_account_idx = db.get_index_type<account_index>().indices().get<by_id>();
|
|
|
|
|
flat_set< public_key_type > acct_addresses;
|
|
|
|
|
acct_addresses.reserve( 2 * GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP + 2 );
|
|
|
|
|
|
|
|
|
|
for( const account_object& acct : primary_account_idx )
|
|
|
|
|
{
|
|
|
|
|
account_id_type account_id = acct.id;
|
|
|
|
|
acct_addresses.clear();
|
|
|
|
|
for( const pair< account_id_type, weight_type >& auth : acct.owner.account_auths )
|
|
|
|
|
{
|
|
|
|
|
if( auth.first.type() == key_object_type )
|
|
|
|
|
acct_addresses.insert( auth.first );
|
|
|
|
|
}
|
|
|
|
|
for( const pair< object_id_type, weight_type >& auth : acct.active.auths )
|
|
|
|
|
{
|
|
|
|
|
if( auth.first.type() == key_object_type )
|
|
|
|
|
acct_addresses.insert( auth.first );
|
|
|
|
|
}
|
|
|
|
|
acct_addresses.insert( acct.options.get_memo_key()(db).key_address() );
|
|
|
|
|
for( const address& addr : acct_addresses )
|
|
|
|
|
tuples_from_db.emplace_back( account_id, addr );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector< pair< account_id_type, address > > tuples_from_index;
|
|
|
|
|
tuples_from_index.reserve( tuples_from_db.size() );
|
|
|
|
|
const auto& key_account_idx =
|
|
|
|
|
db.get_index_type<graphene::account_history::key_account_index>()
|
|
|
|
|
.indices().get<graphene::account_history::by_key>();
|
|
|
|
|
|
|
|
|
|
for( const graphene::account_history::key_account_object& key_account : key_account_idx )
|
|
|
|
|
{
|
|
|
|
|
address addr = key_account.key;
|
|
|
|
|
for( const account_id_type& account_id : key_account.account_ids )
|
|
|
|
|
tuples_from_index.emplace_back( account_id, addr );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: use function for common functionality
|
|
|
|
|
{
|
|
|
|
|
// due to hashed index, account_id's may not be in sorted order...
|
|
|
|
|
std::sort( tuples_from_db.begin(), tuples_from_db.end() );
|
|
|
|
|
size_t size_before_uniq = tuples_from_db.size();
|
|
|
|
|
auto last = std::unique( tuples_from_db.begin(), tuples_from_db.end() );
|
|
|
|
|
tuples_from_db.erase( last, tuples_from_db.end() );
|
|
|
|
|
// but they should be unique (multiple instances of the same
|
|
|
|
|
// address within an account should have been de-duplicated
|
|
|
|
|
// by the flat_set above)
|
|
|
|
|
BOOST_CHECK( tuples_from_db.size() == size_before_uniq );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// (address, account) should be de-duplicated by flat_set<>
|
|
|
|
|
// in key_account_object
|
|
|
|
|
std::sort( tuples_from_index.begin(), tuples_from_index.end() );
|
|
|
|
|
auto last = std::unique( tuples_from_index.begin(), tuples_from_index.end() );
|
|
|
|
|
size_t size_before_uniq = tuples_from_db.size();
|
|
|
|
|
tuples_from_index.erase( last, tuples_from_index.end() );
|
|
|
|
|
BOOST_CHECK( tuples_from_index.size() == size_before_uniq );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//BOOST_CHECK_EQUAL( tuples_from_db, tuples_from_index );
|
|
|
|
|
bool is_equal = true;
|
|
|
|
|
is_equal &= (tuples_from_db.size() == tuples_from_index.size());
|
|
|
|
|
for( size_t i=0,n=tuples_from_db.size(); i<n; i++ )
|
|
|
|
|
is_equal &= (tuples_from_db[i] == tuples_from_index[i] );
|
|
|
|
|
|
|
|
|
|
bool account_history_plugin_index_ok = is_equal;
|
|
|
|
|
BOOST_CHECK( account_history_plugin_index_ok );
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::open_database()
|
|
|
|
|
{
|
|
|
|
|
if( !data_dir ) {
|
|
|
|
|
data_dir = fc::temp_directory( graphene::utilities::temp_directory_path() );
|
2017-07-12 20:03:57 +00:00
|
|
|
db.open(data_dir->path(), [this]{return genesis_state;}, "test");
|
2017-05-25 09:13:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signed_block database_fixture::generate_block(uint32_t skip, const fc::ecc::private_key& key, int miss_blocks)
|
|
|
|
|
{
|
|
|
|
|
skip |= database::skip_undo_history_check;
|
|
|
|
|
// skip == ~0 will skip checks specified in database::validation_steps
|
|
|
|
|
auto block = db.generate_block(db.get_slot_time(miss_blocks + 1),
|
|
|
|
|
db.get_scheduled_witness(miss_blocks + 1),
|
|
|
|
|
key, skip);
|
|
|
|
|
db.clear_pending();
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::generate_blocks( uint32_t block_count )
|
|
|
|
|
{
|
|
|
|
|
for( uint32_t i = 0; i < block_count; ++i )
|
|
|
|
|
generate_block();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks, uint32_t skip)
|
|
|
|
|
{
|
|
|
|
|
if( miss_intermediate_blocks )
|
|
|
|
|
{
|
|
|
|
|
generate_block(skip);
|
|
|
|
|
auto slots_to_miss = db.get_slot_at_time(timestamp);
|
|
|
|
|
if( slots_to_miss <= 1 )
|
|
|
|
|
return;
|
|
|
|
|
--slots_to_miss;
|
|
|
|
|
generate_block(skip, init_account_priv_key, slots_to_miss);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
while( db.head_block_time() < timestamp )
|
|
|
|
|
generate_block(skip);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-04 18:31:45 +00:00
|
|
|
bool database_fixture::generate_maintenance_block() {
|
|
|
|
|
try {
|
|
|
|
|
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
|
|
|
|
|
uint32_t skip = ~database::skip_fork_db;
|
|
|
|
|
auto maint_time = db.get_dynamic_global_properties().next_maintenance_time;
|
|
|
|
|
auto slots_to_miss = db.get_slot_at_time(maint_time);
|
|
|
|
|
db.generate_block(db.get_slot_time(slots_to_miss),
|
|
|
|
|
db.get_scheduled_witness(slots_to_miss),
|
|
|
|
|
committee_key,
|
|
|
|
|
skip);
|
|
|
|
|
return true;
|
|
|
|
|
} catch (std::exception& e)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-25 09:13:59 +00:00
|
|
|
account_create_operation database_fixture::make_account(
|
|
|
|
|
const std::string& name /* = "nathan" */,
|
|
|
|
|
public_key_type key /* = key_id_type() */
|
|
|
|
|
)
|
|
|
|
|
{ try {
|
|
|
|
|
account_create_operation create_account;
|
|
|
|
|
create_account.registrar = account_id_type();
|
|
|
|
|
|
|
|
|
|
create_account.name = name;
|
|
|
|
|
create_account.owner = authority(123, key, 123);
|
|
|
|
|
create_account.active = authority(321, key, 321);
|
|
|
|
|
create_account.options.memo_key = key;
|
|
|
|
|
create_account.options.voting_account = GRAPHENE_PROXY_TO_SELF_ACCOUNT;
|
|
|
|
|
|
|
|
|
|
auto& active_committee_members = db.get_global_properties().active_committee_members;
|
|
|
|
|
if( active_committee_members.size() > 0 )
|
|
|
|
|
{
|
|
|
|
|
set<vote_id_type> votes;
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end());
|
|
|
|
|
}
|
|
|
|
|
create_account.options.num_committee = create_account.options.votes.size();
|
|
|
|
|
|
|
|
|
|
create_account.fee = db.current_fee_schedule().calculate_fee( create_account );
|
|
|
|
|
return create_account;
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW() }
|
|
|
|
|
|
|
|
|
|
account_create_operation database_fixture::make_account(
|
|
|
|
|
const std::string& name,
|
|
|
|
|
const account_object& registrar,
|
|
|
|
|
const account_object& referrer,
|
|
|
|
|
uint8_t referrer_percent /* = 100 */,
|
|
|
|
|
public_key_type key /* = public_key_type() */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
account_create_operation create_account;
|
|
|
|
|
|
|
|
|
|
create_account.registrar = registrar.id;
|
|
|
|
|
create_account.referrer = referrer.id;
|
|
|
|
|
create_account.referrer_percent = referrer_percent;
|
|
|
|
|
|
|
|
|
|
create_account.name = name;
|
|
|
|
|
create_account.owner = authority(123, key, 123);
|
|
|
|
|
create_account.active = authority(321, key, 321);
|
|
|
|
|
create_account.options.memo_key = key;
|
|
|
|
|
create_account.options.voting_account = GRAPHENE_PROXY_TO_SELF_ACCOUNT;
|
|
|
|
|
|
|
|
|
|
const vector<committee_member_id_type>& active_committee_members = db.get_global_properties().active_committee_members;
|
|
|
|
|
if( active_committee_members.size() > 0 )
|
|
|
|
|
{
|
|
|
|
|
set<vote_id_type> votes;
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id);
|
|
|
|
|
create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end());
|
|
|
|
|
}
|
|
|
|
|
create_account.options.num_committee = create_account.options.votes.size();
|
|
|
|
|
|
|
|
|
|
create_account.fee = db.current_fee_schedule().calculate_fee( create_account );
|
|
|
|
|
return create_account;
|
|
|
|
|
}
|
|
|
|
|
FC_CAPTURE_AND_RETHROW((name)(referrer_percent))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const asset_object& database_fixture::get_asset( const string& symbol )const
|
|
|
|
|
{
|
|
|
|
|
const auto& idx = db.get_index_type<asset_index>().indices().get<by_symbol>();
|
|
|
|
|
const auto itr = idx.find(symbol);
|
2019-07-30 15:43:31 +00:00
|
|
|
FC_ASSERT( itr != idx.end() );
|
2017-05-25 09:13:59 +00:00
|
|
|
return *itr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const account_object& database_fixture::get_account( const string& name )const
|
|
|
|
|
{
|
|
|
|
|
const auto& idx = db.get_index_type<account_index>().indices().get<by_name>();
|
|
|
|
|
const auto itr = idx.find(name);
|
2019-07-30 15:43:31 +00:00
|
|
|
FC_ASSERT( itr != idx.end() );
|
2017-05-25 09:13:59 +00:00
|
|
|
return *itr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const asset_object& database_fixture::create_bitasset(
|
|
|
|
|
const string& name,
|
|
|
|
|
account_id_type issuer /* = GRAPHENE_WITNESS_ACCOUNT */,
|
|
|
|
|
uint16_t market_fee_percent /* = 100 */ /* 1% */,
|
|
|
|
|
uint16_t flags /* = charge_market_fee */
|
|
|
|
|
)
|
|
|
|
|
{ try {
|
|
|
|
|
asset_create_operation creator;
|
|
|
|
|
creator.issuer = issuer;
|
|
|
|
|
creator.fee = asset();
|
|
|
|
|
creator.symbol = name;
|
|
|
|
|
creator.common_options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
|
|
|
|
creator.precision = 2;
|
|
|
|
|
creator.common_options.market_fee_percent = market_fee_percent;
|
|
|
|
|
if( issuer == GRAPHENE_WITNESS_ACCOUNT )
|
|
|
|
|
flags |= witness_fed_asset;
|
|
|
|
|
creator.common_options.issuer_permissions = flags;
|
2017-12-13 15:29:39 +00:00
|
|
|
creator.common_options.flags = flags & ~global_settle & ~witness_fed_asset;
|
2017-05-25 09:13:59 +00:00
|
|
|
creator.common_options.core_exchange_rate = price({asset(1,asset_id_type(1)),asset(1)});
|
|
|
|
|
creator.bitasset_opts = bitasset_options();
|
|
|
|
|
trx.operations.push_back(std::move(creator));
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return db.get<asset_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name)(flags) ) }
|
|
|
|
|
|
|
|
|
|
const asset_object& database_fixture::create_prediction_market(
|
|
|
|
|
const string& name,
|
|
|
|
|
account_id_type issuer /* = GRAPHENE_WITNESS_ACCOUNT */,
|
|
|
|
|
uint16_t market_fee_percent /* = 100 */ /* 1% */,
|
|
|
|
|
uint16_t flags /* = charge_market_fee */
|
|
|
|
|
)
|
|
|
|
|
{ try {
|
|
|
|
|
asset_create_operation creator;
|
|
|
|
|
creator.issuer = issuer;
|
|
|
|
|
creator.fee = asset();
|
|
|
|
|
creator.symbol = name;
|
|
|
|
|
creator.common_options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
|
|
|
|
creator.precision = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS;
|
|
|
|
|
creator.common_options.market_fee_percent = market_fee_percent;
|
|
|
|
|
creator.common_options.issuer_permissions = flags | global_settle;
|
|
|
|
|
creator.common_options.flags = flags & ~global_settle;
|
|
|
|
|
if( issuer == GRAPHENE_WITNESS_ACCOUNT )
|
|
|
|
|
creator.common_options.flags |= witness_fed_asset;
|
|
|
|
|
creator.common_options.core_exchange_rate = price({asset(1,asset_id_type(1)),asset(1)});
|
|
|
|
|
creator.bitasset_opts = bitasset_options();
|
|
|
|
|
creator.is_prediction_market = true;
|
|
|
|
|
trx.operations.push_back(std::move(creator));
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return db.get<asset_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name)(flags) ) }
|
|
|
|
|
|
|
|
|
|
const asset_object& database_fixture::create_user_issued_asset( const string& name )
|
|
|
|
|
{
|
|
|
|
|
asset_create_operation creator;
|
|
|
|
|
creator.issuer = account_id_type();
|
|
|
|
|
creator.fee = asset();
|
|
|
|
|
creator.symbol = name;
|
|
|
|
|
creator.common_options.max_supply = 0;
|
|
|
|
|
creator.precision = 2;
|
|
|
|
|
creator.common_options.core_exchange_rate = price({asset(1,asset_id_type(1)),asset(1)});
|
|
|
|
|
creator.common_options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
|
|
|
|
creator.common_options.flags = charge_market_fee;
|
|
|
|
|
creator.common_options.issuer_permissions = charge_market_fee;
|
|
|
|
|
trx.operations.push_back(std::move(creator));
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return db.get<asset_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const asset_object& database_fixture::create_user_issued_asset( const string& name, const account_object& issuer, uint16_t flags )
|
|
|
|
|
{
|
|
|
|
|
asset_create_operation creator;
|
|
|
|
|
creator.issuer = issuer.id;
|
|
|
|
|
creator.fee = asset();
|
|
|
|
|
creator.symbol = name;
|
|
|
|
|
creator.common_options.max_supply = 0;
|
|
|
|
|
creator.precision = 2;
|
|
|
|
|
creator.common_options.core_exchange_rate = price({asset(1,asset_id_type(1)),asset(1)});
|
|
|
|
|
creator.common_options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
|
|
|
|
creator.common_options.flags = flags;
|
|
|
|
|
creator.common_options.issuer_permissions = flags;
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
trx.operations.push_back(std::move(creator));
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return db.get<asset_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::issue_uia( const account_object& recipient, asset amount )
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_MESSAGE( "Issuing UIA" );
|
|
|
|
|
asset_issue_operation op;
|
|
|
|
|
op.issuer = amount.asset_id(db).issuer;
|
|
|
|
|
op.asset_to_issue = amount;
|
|
|
|
|
op.issue_to_account = recipient.id;
|
|
|
|
|
trx.operations.push_back(op);
|
|
|
|
|
db.push_transaction( trx, ~0 );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::issue_uia( account_id_type recipient_id, asset amount )
|
|
|
|
|
{
|
|
|
|
|
issue_uia( recipient_id(db), amount );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::change_fees(
|
|
|
|
|
const flat_set< fee_parameters >& new_params,
|
|
|
|
|
uint32_t new_scale /* = 0 */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
const chain_parameters& current_chain_params = db.get_global_properties().parameters;
|
|
|
|
|
const fee_schedule& current_fees = *(current_chain_params.current_fees);
|
|
|
|
|
|
|
|
|
|
flat_map< int, fee_parameters > fee_map;
|
|
|
|
|
fee_map.reserve( current_fees.parameters.size() );
|
|
|
|
|
for( const fee_parameters& op_fee : current_fees.parameters )
|
|
|
|
|
fee_map[ op_fee.which() ] = op_fee;
|
|
|
|
|
for( const fee_parameters& new_fee : new_params )
|
|
|
|
|
fee_map[ new_fee.which() ] = new_fee;
|
|
|
|
|
|
|
|
|
|
fee_schedule_type new_fees;
|
|
|
|
|
|
|
|
|
|
for( const std::pair< int, fee_parameters >& item : fee_map )
|
|
|
|
|
new_fees.parameters.insert( item.second );
|
|
|
|
|
if( new_scale != 0 )
|
|
|
|
|
new_fees.scale = new_scale;
|
|
|
|
|
|
|
|
|
|
chain_parameters new_chain_params = current_chain_params;
|
Hotfix/remove smart ref (#396)
* Merge develop into beatrice (#386)
* Fix building on Ubuntu 18.04 with GCC 7
* Peerplays SON plugin skeleton (#122)
* Peerplays SON plugin skeleton
* SON tests skeleton
* Part two of SON-83 - plugins option in command line and config file (#126)
- Empty SON plugin is INACTIVE by default
- To enable it, add peerplays_sidechain to plugins section in
config file, or use --plugins command line option
- Plugin can work with or without witness
* SON11 - Add chain extension parameter to set SON count
* [SON-107] Merge develop branch to SONs-base (#166)
* fix rng and get_winner_numbers implemented
* coipied code for bitshares fixing 429 and 433 isuues
* ticket_purchase_operation implemented. added lottery_options to asset
* lottery end implemented
* minor logic changes. added db_api and cli_wallet methods
* fix reindex on peerplays network
* fix some tests. add gitlab-ci.yml
* add pull to gitlab-ci
* fix
* fix and comment some tests
* added owner to lottery_asset_options. commented async call in on_applied_block callback
* added get_account_lotteries method to db_api and cli, lottery end_date and ticket_price verification
* merge get_account_lotteries branch. fix create_witness test
* fix test genesis and end_date verification
* fixed indices sorting and lottery end checking by date
* update db_version for replay and removed duplicate include files
* Added ntp and upgraded boost version
* Revert "GPOS protocol"
* need to remove backup files
* virtual-op-fix for deterministic virtual_op number
* Merged beatrice into 5050
* Updated gitmodules, changes to allow voting on lottery fee
* Removed submodule libraries/fc
* Added libraries/fc
* added missing , in types.hpp
* Added sweeps parameters to parameter_extension
* added missing comma in operations.hpp, small changes to config.hpp
* fixed returntype in chain_parameters.hpp
* removed sweeps_parameter_extensions
* Changed fc library
* fixed asset_object
* Changed peerplays-fc submodule
* Changed fc submodule to ubuntu 18.04 upgrade
* Removed submodule libraries/fc
* Added fc library back
* fix casting in overloaded function
* Removed blind_sign and unblind_signature functions
* Added new lottery_asset_create_operation
* Changed sweeps hardfork time
* Removed redundant if from asset_evaluator and fixed db_notify
* fixed duplicate code in fee_tests
* removed redundant tgenesis file
* Enable building on Ubuntu 18.04 using GCC 7 compiler
* fix: is_benefactor_reward had the default value of true when not set
* Docker file for Ubuntu 18.04
Base image updated to Unbuntu 18.04
Prerequisite list updated
Basic configuration updated
* Quick fix: Added missing package pkg-config
* Docker file updates
* 5050 fee update and compilation error fix
* Dockerfile, set system locale
Prevents locale::facet::_S_create_c_locale name error
* Update README.md
Fix typo
* Update README.md
* Changed hardfork time for SWEEPS and Core-429
* revert master changes that were brought in previous commit
* Fixed error when account_history_object with id 0 doesnt exist
* Fixed error while loading object database
* test for zero id object in account history
* Reorder operations in Dockerfile, to make image creation faster
- Reorder prevents unnecessary building of Boost libraries
* Fix for irrelevant signature included issue
* fix copyrigth messages order
* remove double empty lines
* Backport fix for `get_account_history` from https://github.com/bitshares/bitshares-core/pull/628 and add additional account history test case
* NTP client back
* GRPH-53-Log_format_error
* Merge pull request #1036 from jmjatlanta/issue_730
Add fail_reason to proposal_object
* Unit test case fixes and prepared SONs base
* Use offsetof instead of custom macro
* Hide some compiler warnings
* Make all the tests compile
* Add nullptr check in api.cpp for easier testing
* Add test case for broadcast_trx_with_callback API
* Unit test case fixes and prepared SONs base
* Merge pull request #714 from pmconrad/json_fix
JSON fix
* Increase max depth for trx confirmation callback
* Adapt to variant API with `max_depth` argument
* Update fc submodule
* Created unit test for #325
* remove needless find()
* GRPH-4-CliWallet_crash_ctrlD
* fix copyright message
* Make all the tests compile
* increase delay for node connection
* Increase block creation timeout to 2500ms
* remove cache from cli get_account
* add cli tests framework
* Adjust newly merged code to new API
* Improved resilience of block database against corruption
* Merged changes from Bitshares PR 1036
* GRPH-76 - Short-cut long sequences of missed blocks
Fixes database::update_global_dynamic_data to speed up counting missed blocks.
(This also fixes a minor issue with counting - the previous algorithm would skip missed blocks for the witness who signed the first block after the gap.)
* Moved reindex logic into database / chain_database, make use of additional blocks in block_database
Fixed tests wrt db.open
* Enable undo + fork database for final blocks in a replay
Dont remove blocks from block db when popping blocks, handle edge case in replay wrt fork_db, adapted unit tests
* Log starting block number of replay
* Prevent unsigned integer underflow
* Fixed lock detection
* Dont leave _data_dir empty if db is locked
* Writing the object_database is now almost atomic
* Improved consistency check for block_log
* Cut back block_log index file if inconsistent
* Fixed undo_database
* Added test case for broken merge on empty undo_db
* Merge pull request #938 from bitshares/fix-block-storing
Store correct block ID when switching forks
* exclude second undo_db.enable() call in some cases
* Add missing change
* change bitshares to core in message
* Fixed integer overflow issue
* Fix for for history ID mismatch ( Bitshares PR #875 )
* Update the FC submodule with the changes for GRPH-4
* Fix #436 object_database created outside of witness data directory
* supplement more comments on database::_opened variable
* prevent segfault when destructing application obj
* Fixed duplicate ops returned from get_account_history
* minor performance improvement
* Added comment
* Merged Bitshares PR #1462 and compilation fixes
* Support/gitlab (#123)
* Updated gitlab process
* Fix undefined references in cli test
* Fixed test failures and compilation issue
* Fixed account_history_pagination test
* Fix compilation in debug mode
* Removed unrelated comment
* Skip auth check when pushing self-generated blocks
* Extract public keys before pushing a transaction
* Dereference chain_database shared_ptr
* Updated transaction::signees to mutable
and
* updated get_signature_keys() to return a const reference,
* get_signature_keys() will update signees on first call,
* modified test cases and wallet.cpp accordingly,
* no longer construct a new signed_transaction object before pushing
* Added get_asset_count API
* Allow sufficient space for new undo_session
* Throw for deep nesting
* No longer extract public keys before pushing a trx
and removed unused new added constructor and _get_signature_keys() function from signed_transaction struct
* Added cli_test to CI
* use random port numbers in app_test (#154)
* proposal fail_reason bug fixed (#157)
* Added Sonarcloud code_quality to CI (#159)
* Added sonarcloud analysis (#158)
* fix for lottery end
* fix declarations
* fix declarations
* fix boost integer
* fix compilation
* fix chain tests
* fix app_test
* try to fix cli test
* fix incorrect max_depth param
* working cli test
* correct fc version
* Revert "[SON-107] Merge develop branch to SONs-base (#166)"
This reverts commit 499e3181990d7b732459a38263a6039703c94720.
* Fix build error, add missing GRAPHENE_MAX_NESTED_OBJECTS parameter
* Plugin description added, SON plugin params example
* fix for cli test
* SON object, operations, cli_wallet commands and RPC (#160)
- create_son, update_son, delete_son, list_sons
- get_sons, get_son_by_account, lookup_son_accounts, get_son_count
- vote_for_son, update_son_votes
- claim_registered_son
- get_son in cli_wallet
- Updating global_property_object
- Decrease SON hardfork time for test purposes
- CLI Wallet tests imported from develop branch
* fix affiliate tests
* SON-108 - Add cli wallet tests for create_son (#174)
* SON-108 - Add cli wallet tests for create_son
* Add info message at the beginning and end of the SON CLI tests
* Minor output message change
* Enable Boost test messages in unit tests
* [SON-110] get_son cli test (#173)
* get_son cli test
* update_son cli test
* Add cli wallet tests for vote_for_son (#175)
* fix insert object processing in indexes, son_delete is working
* Fix segfault when using delete_son from cli_wallet (#177)
* Fix segfault when using list_sons from cli_wallet (#178)
* Add son_delete cli tests (#182)
* Add son_delete cli tests
* add son vesting config options
* add vesting balance type support
* add dormant vesting policy for son
* add precision to son vesting amount
* SON118-Add Budget for SON (#165)
* SON118-Add Budget for SON
* SON118 - Compilation errors fix
* SON118 - Proper commenting around pay_sons function
* SON118 - Comment correction, SON statistics object implementation type correction
* SON118 - Add missing index init and reflect enums
* SON118 - Correcting the indentation
* SON118 SON144 - Add unit test, code fixes and resolve failures for existing tests
* SON118 SON144 - Removing extra spaces added
* abstraction of dormant vesting policy
* force son create vesting balance to have dormant policy
* remove not needed code from wallet son commands, add delete son test to cli (#181)
* Active SONs, list up to 15, order by votes, add test (#185)
* Add test for selecting 15 SONs with highest votes
* Display up to 15 active SONs, SON ordering by total_votes
* fix build error (#191)
* fix build error
* adapt son_pay_test to dormant vesting policy
* [SON-113] Unit test for cli `update_son_votes` (#179)
* refactor cli tests
* update_son_votes tests
* list_sons test
* test changes in get_global_properties() result
* fix generate_block failure
* fix update_son_votes test
* improve update_son cli test
* fix linking errors
* refactor select_top_fifteen_sons test
* refactor other son cli tests to use son_test_helper
* create_vesting call in wallet_api
* test fix
* fix create_son in wallet_api and cli tests
* SON126 - Witness Proposals to deregister SONs (#192)
* SON126 - Witness Proposals to deregister SONs
* SON126 - Approval by witness, removal of son_proposal_object, commenting
* SON126 - Witness proposal tests and related fixes
* SON126 - Proper commenting
* fix son_delete_operation reflection
* [SON-160] Fix create_vesting wallet_api call (#206)
* Fix create_vesting wallet_api call
* change type for vesting_type in create_vesting_balance
* [SON-113] Fix several issues in update_son_votes call in wallet_api (#208)
* do not allow update votes with both empty lists
* fix error messages
* check number of sons against votes number in account_object
* Update error message
* list_active_sons api call implementation
* unit test for list_active_sons
* fix code style
* use assert instead of checking condition with low possibility
* Fixed betting tests (#217)
* Fixed betting tests
* Removed comments
* removed unrelated parameter description from delete_son
* Add Bitcoin network listener to a SON plugin (#196)
* Add Bitcoin network listener to a SON plugin
* Add default parameters for Peerplays Bitcoin test node
* Add Bitcoin block processing
* Update source code to last designs
* Set default parameters for peerplays_sidechain plugin to Bitcoin test server
* WIP: Some Bitcoin transaction processing
* [SON-199] Fix unit tests (#233)
* fix app_test
* fix son_delete_test
* Add peerplays account for a SON in a config/command line options (#231)
* SON193-SON200- SON Heartbeats and maintenance mode changes (#241)
* SON193-SON200- SON Heartbeats and maintenance mode changes
* SON193-SON200- SON Heartbeats and maintenance tests
* User sidechain address mappings (#240)
* WIP: Sidechain objects
* Revert "WIP: Sidechain objects"
This reverts commit 8676940a281604688771e96ceb1e65a35d98e8e5.
* WIP: User sidechain address mappings
* Fix reflection problem
* Reflect missing members of sidechain_address_update_operation
* Add sidechain address operation tests
* Enable RPC calls
* Fix build errors due to merge conflict
* Fix RPC, add CLI wallet commands for sidechain addresses
* Improved peerplays_sidechain_plugin_impl
* Remove short param for son-id
* Fix crashing errors on bitcoin event received
* Code review changes
* SON207 - Introduce scheduling for SONs similar to witnesses (#251)
* Extend SON objects to contain sidechain public keys (#254)
* SON194-SON195 - Report SON Down, addition of SON Account for sidechain consensus (#244)
* SON194-SON195 - Addition of SON BTC Account and report son down changes
* SON194-SON195 - SON BTC Account errors rectification
* SON194-SON195 - Adding Tests
* User sidechain address mappings (#240)
* WIP: Sidechain objects
* Revert "WIP: Sidechain objects"
This reverts commit 8676940a281604688771e96ceb1e65a35d98e8e5.
* WIP: User sidechain address mappings
* Fix reflection problem
* Reflect missing members of sidechain_address_update_operation
* Add sidechain address operation tests
* Enable RPC calls
* Fix build errors due to merge conflict
* Fix RPC, add CLI wallet commands for sidechain addresses
* Improved peerplays_sidechain_plugin_impl
* Remove short param for son-id
* Fix crashing errors on bitcoin event received
* Code review changes
* SON207 - Introduce scheduling for SONs similar to witnesses (#251)
* Extend SON objects to contain sidechain public keys (#254)
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
* SON206 - Plugin SON Heartbeat changes (#250)
* SON206 - Plugin SON Heartbeat changes
* SON206 - Plugin SON Heartbeat changes, comment removal
* SON206 - Plugin SON Heartbeat changes, stub testing and changes
* SON206 - Plugin SON Heartbeat changes, removing debugs prints
* Wallet recreation on new set of SONs voted in (#256)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* Fix build errors
* SON212-SON213 - Add Sidechain Plugin Code to report and approve SON Down proposal (#260)
* SON212 - Add Sidechain Plugin Code to report SON Down
* SON212-SON213 - Add Sidechain Plugin Code to report SON Down, Approve proposal from sidechain plugin
* SON212-SON213 - Fix Build Error (#262)
* SON212-SON213 - Fix Build Error
* SON212-SON213 - Fix Build Error Add smart_ref definition for linking
* Updated gitlab CI to sync submodules (#265)
* SON217 - SON Maintenance,Heartbeat state transition changes (#264)
* SON217 - SON Maintenance,Heartbeat state transition changes
* SON217 - SON Maintenance,Heartbeat state transition changes
* [SON-202] Implement cli_wallet commands for maintenance mode (#261)
* Add stop_son_maintenance CLI call
* fix bug with SON activation
* son_maintenance_operation
* son_maintenance_operation tests
* cli test for son maintenance state
* start_son_maintenance CLI call
* keep maintenance state during active SON set changes
* Quick fix for list_active_sons
* SON199 - Fix Unit Test Failure (#268)
* Quickfix for update_sidechain_address and delete_sidechain_address cli commands
* SON206_Plugin_CrashFix_Reorg - Plugin Changes (#272)
* SON206_Plugin_CrashFix_Reorg - Plugin Changes
* SON206_Plugin_CrashFix_Reorg - add owner auths to consensus account
* SON165 - Keys mapping missing from wallet data (#274)
* SON232 - Avoid duplicate proposals from sidechain plugin (#275)
* SON233 - Provide correct downtime metrics to user (#278)
* son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
* SON214 - Request maintenance wallet commands (#280)
* SON wallet transfer object and operations (#279)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add is_active_son guards for sidechain events processing
Co-authored-by: gladcow <jahr@yandex.ru>
* Support multiple SON nodes per software instance (#282)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Temoprary disable account history tests for tracking accounts
Co-authored-by: gladcow <jahr@yandex.ru>
* [SON-209] Create P2SH address with custom redeemScript (#271)
* Create redeem script for SONs primary wallet
* Add importaddress call
Allows to watch for related transactions without private keys import
* Get UTXO set for watched addresses
* createrawtransaction call
* signing PW spending transaction
* unit test for btc tx serialization
* sending PW transfer in test
* BIP143 tx signing
* use bech32 address format
* use single sha256 for lock script
* Digest fix
* working signing
* separate signing
* test partially signed PW transfer
* add ability to gather signatures before signing (#290)
* [SON-242] fix list_active_sons call after deleting an active son (#292)
* test to reproduce error in list_active_sons after delete_son
* prevent exception in list_active_list
* [SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
* SON261 - Bitcoin deposit, withdrawal, PW transfer (#287)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* SON261 - Deposit transfer ( user address -> PW ) and Withdrawal transfer ( PW -> user address ) for m-of-n multisig
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* SON261 - Withdrawal transfer ( PW -> user address ), addition of bitcoin public private key to config.ini for multiple sons mode
* Withdrawal refactoring
* Withdrawal refactoring
* SON261 - Fix prepare_tx
* SON261 - Add PW->PW Transfer and Code reorg
* Fix file permissions
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: gladcow <jahr@yandex.ru>
* [SON-264] Integrating deposit/withdrawals with bitcoin transactions (feature/SON-260 + SON261 branches) (#291)
* Partial integration done, some Bitcoin RPC refactoring
* CLang Format config file
* CLang Format config file v2.0
* Fix repeating tasks that should be executed by scheduled SON only
* Fix withdrawal
* Integrate PW wallet fund moving
* Resolve conflicts
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: satyakoneru <satyakoneru.iiith@gmail.com>
* SON200 - SON Down proposal broken after latest merges (#294)
* SON200 - SON Down proposal broken after latest merges
* Add the owner weight threshold similar to witnesses and committee accounts
* SON269 - Move SON deregistration to Plugin from witness (#298)
* SON200 - SON Down proposal broken after latest merges
* Add the owner weight threshold similar to witnesses and committee accounts
* SON269 - Move SON deregistration to Plugin from witness
* Various SON improvements (#297)
* Refactor SON processing
* Better exposure of sidechain private keys in sidechain handlers
* Support non default Bitcoin wallets
* Fix crash on config file recreation
* clang-format formatting
* New Bitcoin wallet related RPC calls
* Add missing create_son_deregister_proposals calls
* Add missing create_son_deregister_proposals calls
* Add loading/unlocking/locking of non-default bitcoin wallet
* Bitcon RFC logs improved, proposal aprovement improved
* Move signal connection after handlers are created
* Merge develop into SONS
* SON118 - Add tx sign metrics for SON rewards (#302)
* resolved compilation issues and other conflicts
* SON202 - Maintenance improvements (#303)
* Quickfix, remove dead code, return result from wallet withdraw do_evaluate
* SON275 - ZMQ Crash on application exit (#306)
* SON275 - ZMQ Crash on application exit
* SON275 - Fix Indentation
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* need to assign both name and id to stats id
* fix unit test case failures(add gpos vesting before voting)
* SON276 - Fix SON proposal exceptions - I (#307)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Add SON statistic for tracking reported sidechain transactions (#308)
- Deposit and Withdrawal object extended to contain expected
and received transaction reports from SON network
- SON statistic object extended to contain total number of
sidechain transactions reported by SON network when SON was
active and number of transactions reported by single SON when
he was active
- Code formatting
* Allow voting for son, only if GPOS vesting balance available
* notifications of SONS should get restrict to sons functionality
* update GPOS hardfork date to sons branch
* SON127 - Add son parameter extensions to genesis, push proposal fix (#310)
* SON276 - Fix SON proposal exceptions - I
* SON127 - Add son parameter extensions to genesis, push proposal fix
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* update GPOS HF to fall in before SONS HF, remove check
* updated unit test cases to reflect GPOS vesting and update account id's according to sons-account
* [SON-24] - SON Rewards missing serialisations and end to end testing (#313)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Revert "Merge develop branch changes(GPOS+graphene updates) into SONs branch"
* [SON-122] - SON Statistics improvements and consensus account creation (#318)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Replace raw with psbt transactions to support parital tx signing (#311)
* RPC calls for PSBT, raw transactions replaced with PSBT
* Fix estimatesmartfeerate, extensive RPC calls logging for debugging purposes
* Remove dead code
* Partial signing functional for deposit and withdrawal
* Fix sidechain_type declarations
* Depositing Peerplays asset refactored
* Partial signing functional for primary wallet funds moving
* Prettier logs
* Refactor multiple SON support processing
* Serialize field complete from sidechain_transaction_sign_operation
* Refactor transaction signing in particular order, BTC only (maybe) need it
* Add number of required signatures parameter for addmultisigaddress
* Change default bitcoin node parameters
* Transaction signing only by scheduled son
* Removed scheduling log
* Prevent PW funds moving to the same address
* Refactor sidechain_transaction_object processing, code cleanup
* Remove obsolete tests
* Decrease logging
* Code readability
* When updated, import son wallet bitcoin address to bitcoin wallet
* When updated, recreate son wallet bitcoin address on each node
* Refactor on_changed_objects, move it into task
* Add check to prevent deposit/withdrawal double processing
* Improved check for sidechain transaction object creation
* Single sidechain transaction signature per block allowed only
* Unlock wallet on addmultisigaddress
* Import both address and redeem script on primary wallet change, fix some compiler warnings
* Fix invalid list of signers for PW funds transfer
* [SON-312] Refactor create_son to assign owner account public key as a signing_key
remove key derivation from create son (#323)
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* [SON-271] Merge recent develop branch changes(both GPOS and graphene updates) into SONs branch (#322)
* Parallelizing sidechain transaction signing (#319)
* [SON-321, SON-323] Deposit/Withdraw object creation refactoring (#320)
* Remove proposals for creating deposit and withdrawal objects, strenghten evaluator checks
* Only active SON can create the object
* Only expected SON can confirm the transaction
* Transaction must be initiated (paid) by SON account owner (SON account given in operation)
* Transaction confirmation must contain exactly the same data as existing object
* Mirror SON owner account weights from son-account.active.account_auths to active SONs
* Fix duplicated typedef, peerplays_sidechain::sidechain_type to chain::sidechain_type
* Add missing serialized field
* [SON-318_SON-319] - Add approval checks for son down, deregister proposals (#321)
* [SON-318_SON-319] - Add approval checks for son down and deregister proposals
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
* [SON-311] Add try_create_son call without explicit deposit params (#324)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - Fix build error
* Quickfix - change GPOS and SON hardfork times
* [SON-332] Check gitlab building process for dirty build (#327)
* Fix failing son test, fix data types and check condition
* Very clean build on Gitlab
* update son-account parameters (#328)
* [SON-329] Hotfix - Enable test test_update_dividend_interval
* [SON-313] - Limit SON functionality when min no. of sons are not present (#329)
* [SON-313] - Limit SON functionality when min no. of sons are not present
* Revert SON HF related checks and tests
* Remove the capability to process proposals in plugin
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-307] Create PBTC asset (#326)
* SON-297_SON-336 - SON vesting functionality broken after graphene merge (#331)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Hotfix - add initialization values to extension params, remove trailing spaces
* [SON-305, SON-308, SON-310] Use BTC asset in bitcoin deposits and withdraws (#332)
* [SON-339] - SON Schedule crash (#334)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-291,SON-328] - SON Configuration invalid, PW creation issues (#335)
* [SON-291,SON-328] - SON Configuration invalid, PW creation issues
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-322, SON-324] Approval checks for processing deposit/withdrawal (#330)
* Refactor proposal processing
* Added check for approving son_wallet_deposit_process_operation
* Added check for approving son_wallet_withdraw_process_operation
* Calculating exchange rates fixed
* Fix depositing Peerplays assets
* [SON-320] Added check for approving son_wallet_update_operation (#336)
* [SON-325] Added check for approving sidechain_transaction_create_operation (#337)
* [SON-341, SON-342] Fix issue with deposits number (#339)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* [SON-344] BTC asset is created with wrong quote asset id, Fixed (#341)
* [SON-344] BTC asset is created with wrong quote asset id, Fixed
* Respond to code review
* [SON-346] Sidechain transaction marked as complete even though current_weight < threshold, Fixed (#342)
* [SON-348] Transaction hash not saved in object after Bitcoin transaction is sent (#343)
- Fixed
- Unused parameters removed
* [SON-337] - Prevent update_son_votes without GPOS vesting (#344)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-353] Refactor PW processing, PW transfer fixed (#347)
* Add proposal checks for deposit and withdrawal
* Refactor proposal approvement
* Fix transaction verification
* Remove logs
* [SON-354] Fix son_info compare function (#350)
* check object's id (#351)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* SON Weighted Multi Signature Signing (#349)
* Bring in the bitcoin utils code into plugin
* Add tx creation, signing and tests
* tx deserialization fix
* add 10-of-14 multisig address test
* Add signing and verification tests and sign_transaction_standalone
* Add send_transaction_standalone function
* Debug logs and additional tests
* Fix for son deletion in the middle
* Extend script_builder
* Witness script for weighted wallet
* btc_weighted_multisig_address implementation
* Fix for bad-txns-nonstandard-inputs
* Weighted multisignature address test
* Create test tx with weighted multisig wallet
* Fix the issues with tx signing
* End to End test weighted multi sig
* 1 or m-of-n deposit address support
* Move network_type enum to the base class
* btc_one_or_weighted_multisig_address implementation
* Simplify redeem script
* Fix error in redeem_script
* btc_one_or_weighted_multisig_address tests
* Refactor sidechain address mapping
* CLANG code format
* CLANG code format sidechain tests
* Integration of deposit and rest of weighted wallets, withdrawal fee fix, whole code refactoring
* Move util functions to Utils file
* Add proper checks for withdraw fee
* Deposit address creation, import deposit/withdraw addresses, some code cleanup
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
* [SON-349] Delay BTC asset issue/reserve until tx confirmed on sidchain (#348)
* Separate transaction settling from deposit/withdrawal processing
* Handle peerplays deposits with transaction settling
* Remove logs
* All dev features enabled/disabled with single flag
* Deposit/withdraw process and sidechain transaction creation in single proposal
* Hotfix - remove importing sidechain addresses
* Hotfix - remove redundant deposit sidechain address recreation
* private-key option update
* Use decoderawtraction json for proposal approvals (#352)
* Use decoderawtraction json for proposal approvals
* Use default null string to get first vout
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Prevent incorrect signatures to be added to transaction (#354)
* Prevent incorrect signatures to be added to transaction
* Check signers list before signing
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Hotfix - use getrawtransaction for approvals and settling (#355)
* Revert "Use decoderawtraction json for proposal approvals (#352)"
This reverts commit d3385b28cb75bbf43ff6fbcccee404d2183ff8a7.
* User getrawtransaction for proposal approvals and settling
* Code cleanup
* [SON-135] Add timelock to user deposit address (#356)
* timelocks
* timelocked deposit address
* test for deposit timelock
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - fix threshold_weight calculation in redeem scripts
* fix broken peerplays_sidechain tests (#357)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - Save deposit address redeem and witness script into sidechain address object
* [SON-359] - Fix Errors processing to-be-refunded deposits (#358)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-363] - Remove son deletion (#359)
* [SON-363] - Remove son deletion
* Fix the tests
* [SON-314] - Weighted Rewards and equal weighted son-account (#360)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Bitcoin network type deduction (#361)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* chore: changed building to debug mode
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* chore: updated Dockerfile with dnsutils
* GPOS2 HF - Handle rolling period on missing blocks (#369)
* Mainnet chain halt 5050 Issue (#370)
* Peerplays Marketplace + NFT (#367)
* ppy marketplace 1 - add evaluators and objects
* NFT object and basic operations
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* NFT evaluators and basic tests, no evaluator checks
* Evaluator checks in place
* ppy marketplace 2 - batch sale, offer_object escrow
* Database API
* Wallet API
* NFT metadata implemented
* Fix NFT tests
* Database API for NFT metadata and enumerables
* ppy marketplace 4 - Add tests NFT+Marketplace
* ppy marketplace 5 - Add revenue split
* ppy marketplace 6 - Remove unnecessary files
* ppy marketplace 7 - Add db, wallet changes and some NFT fixes
* ppy marketplace 8 - Add pagination for list APIs
* New DB API, list all NFTs, list NFTs by owner
* Marketplace + NFT + RBAC (#368)
* rbac1 - evaluators and op validators added
* rbac2 - op_type hf checks
* rbac3 - tx auth verify changes
* Update .gitlab-ci.yml
* rbac4 - basic op tests
* rbac5 - clear expired and deleted permission linked auths
* rbac6 - more tests
* rbac7 - more tests
* rbac8 - more tests
* rbac9 - wallet and db api changes
* rbac10 - db api changes for required signature fetch
* rbac11 - add db_api tests
* rbac12 - add missing code for key auths
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
* Fix nft_get_token_uri returning empty string
* Fix nft_mint_evaluator to save token_uri
* Fix cli_wallet to properly pass metadata id for nft_create
* ppy marketplace 9 - FC_REFLECT offer create op
* Add stricter checks to NFTs
* Unlisting offers, add result in offer history object
* Reverting genesis.json wrong commit
* Add non-transferable non-sellable properties to NFTs
* Review comments - change variable names, use scoped enums
* nft_metadata_update changes
* NFT HF checks and op fee addition changes
* NFT make revenue_split integer from double
* revenue_split condition check allow zero or above
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Son deposit address enhancements (#362)
* Deposit address enhancements
* fix tests
Co-authored-by: Koneru Satyanarayana <15652887+satyakoneru@users.noreply.github.com>
* Ws updates
* Fix for custom operation authority checking (BTS Issue #210) (#382)
* Resolve #210: [HF] Check authorities on custom_operation
The required_auths field on custom_operation was being ignored during authority checking. This commit causes it to be checked correctly, and adds a unit test verifying as much.
* Ref #381: Fixes
Build and logic fixes for Pull Request #381
* Ref #381: Fix bad merge
During merge conflict resolution, I accidentally broke custom
authorities. This fixes it.
* compilation fix
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
* Cleanup changes for pretier diff
* Cleanup changes for prettier diff
* NFT Permissions (#380)
* Account Roles Permission 1 - Working code with tests
* Account Roles Permission 2 - Add marketplace offer/bid tests
* Account Roles Permission 3 - Add Op check
* Account Roles Permission 4 - Add chain params and limits
* Cleanup changes for prettier diff
* Fix failing saving_keys_wallet_test
* Fix failing saving_keys_wallet_test
* Align submodule versions
* Add missing break
* Increase tests log_level, some cleanup
* Decrease log level for tests
* Fix block_tests/maintenance_interval test
* Fix son_operation_tests/son_pay_test test
* Remove base_uri length checks
* Fix HF info
Co-authored-by: S <obucinac@gmail.com>
Co-authored-by: Bobinson K B <bobinson@gmail.com>
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: satyakoneru <satyakoneru.iiith@gmail.com>
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Sandip Patel <sandip@knackroot.com>
Co-authored-by: Roshan Syed <r.syed@pbsa.info>
Co-authored-by: pbattu123 <p.battu@pbsa.info>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: blockc p <pravin.blockc@gmail.com>
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
* SON hardfork time to Saturday, October 17, 2020 00:00:00 UTC
* hotfix - chain params variable overflow, rbac hf check (#387)
* hotfix - son max count fix
* init variables
* Update SON HF time to October 20th 2020, 00:00:00
* Update SON HF time to October 20th 2020, 00:00:00
* Release build fix, missing includes (#391)
fixes https://github.com/peerplays-network/peerplays/issues/390
* Fix release build on 18.04, fc::smart_ref_* removed
* Gitlab will build Debug and Release versions
* Revert "Gitlab will build Debug and Release versions"
This reverts commit 7a721f8094e264417aa8519ca90e68f2b23aeebc.
* Gitlab will build Release version only
* add safe copy
* verify_transaction proper value
* proper init of publick_key
Co-authored-by: serkixenos <70147861+serkixenos@users.noreply.github.com>
Co-authored-by: S <obucinac@gmail.com>
Co-authored-by: Bobinson K B <bobinson@gmail.com>
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Sandip Patel <sandip@knackroot.com>
Co-authored-by: Roshan Syed <r.syed@pbsa.info>
Co-authored-by: pbattu123 <p.battu@pbsa.info>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: blockc p <pravin.blockc@gmail.com>
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
Co-authored-by: Serki <serki.xenos@gmail.com>
2020-10-22 18:03:46 +00:00
|
|
|
new_chain_params.current_fees = std::make_shared<fee_schedule>(new_fees);
|
2017-05-25 09:13:59 +00:00
|
|
|
|
|
|
|
|
db.modify(db.get_global_properties(), [&](global_property_object& p) {
|
|
|
|
|
p.parameters = new_chain_params;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const account_object& database_fixture::create_account(
|
|
|
|
|
const string& name,
|
|
|
|
|
const public_key_type& key /* = public_key_type() */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
trx.operations.push_back(make_account(name, key));
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
auto& result = db.get<account_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const account_object& database_fixture::create_account(
|
|
|
|
|
const string& name,
|
|
|
|
|
const account_object& registrar,
|
|
|
|
|
const account_object& referrer,
|
|
|
|
|
uint8_t referrer_percent /* = 100 */,
|
|
|
|
|
const public_key_type& key /*= public_key_type()*/
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
trx.operations.resize(1);
|
|
|
|
|
trx.operations.back() = (make_account(name, registrar, referrer, referrer_percent, key));
|
|
|
|
|
trx.validate();
|
|
|
|
|
auto r = db.push_transaction(trx, ~0);
|
|
|
|
|
const auto& result = db.get<account_object>(r.operation_results[0].get<object_id_type>());
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
FC_CAPTURE_AND_RETHROW( (name)(registrar)(referrer) )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const account_object& database_fixture::create_account(
|
|
|
|
|
const string& name,
|
|
|
|
|
const private_key_type& key,
|
|
|
|
|
const account_id_type& registrar_id /* = account_id_type() */,
|
|
|
|
|
const account_id_type& referrer_id /* = account_id_type() */,
|
|
|
|
|
uint8_t referrer_percent /* = 100 */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
|
|
|
|
|
account_create_operation account_create_op;
|
|
|
|
|
|
|
|
|
|
account_create_op.registrar = registrar_id;
|
|
|
|
|
account_create_op.name = name;
|
|
|
|
|
account_create_op.owner = authority(1234, public_key_type(key.get_public_key()), 1234);
|
|
|
|
|
account_create_op.active = authority(5678, public_key_type(key.get_public_key()), 5678);
|
|
|
|
|
account_create_op.options.memo_key = key.get_public_key();
|
|
|
|
|
account_create_op.options.voting_account = GRAPHENE_PROXY_TO_SELF_ACCOUNT;
|
|
|
|
|
trx.operations.push_back( account_create_op );
|
|
|
|
|
|
|
|
|
|
trx.validate();
|
|
|
|
|
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
const account_object& result = db.get<account_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
FC_CAPTURE_AND_RETHROW( (name)(registrar_id)(referrer_id) )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const committee_member_object& database_fixture::create_committee_member( const account_object& owner )
|
|
|
|
|
{
|
|
|
|
|
committee_member_create_operation op;
|
|
|
|
|
op.committee_member_account = owner.id;
|
|
|
|
|
trx.operations.push_back(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
return db.get<committee_member_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const witness_object&database_fixture::create_witness(account_id_type owner, const fc::ecc::private_key& signing_private_key)
|
|
|
|
|
{
|
|
|
|
|
return create_witness(owner(db), signing_private_key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const witness_object& database_fixture::create_witness( const account_object& owner,
|
|
|
|
|
const fc::ecc::private_key& signing_private_key )
|
|
|
|
|
{ try {
|
|
|
|
|
witness_create_operation op;
|
|
|
|
|
op.witness_account = owner.id;
|
|
|
|
|
op.block_signing_key = signing_private_key.get_public_key();
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2017-11-13 07:14:07 +00:00
|
|
|
secret_hash_type::encoder enc;
|
|
|
|
|
fc::raw::pack(enc, signing_private_key);
|
2018-01-09 08:45:19 +00:00
|
|
|
fc::raw::pack(enc, secret_hash_type());
|
2019-07-30 15:43:31 +00:00
|
|
|
op.initial_secret = secret_hash_type::hash(enc.result());
|
2017-05-25 09:13:59 +00:00
|
|
|
trx.operations.push_back(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.clear();
|
|
|
|
|
return db.get<witness_object>(ptx.operation_results[0].get<object_id_type>());
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW() }
|
|
|
|
|
|
|
|
|
|
uint64_t database_fixture::fund(
|
|
|
|
|
const account_object& account,
|
|
|
|
|
const asset& amount /* = asset(500000) */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
transfer(account_id_type()(db), account, amount);
|
|
|
|
|
return get_balance(account, amount.asset_id(db));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::sign(signed_transaction& trx, const fc::ecc::private_key& key)
|
|
|
|
|
{
|
|
|
|
|
trx.sign( key, db.get_chain_id() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
digest_type database_fixture::digest( const transaction& tx )
|
|
|
|
|
{
|
|
|
|
|
return tx.digest();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const limit_order_object*database_fixture::create_sell_order(account_id_type user, const asset& amount, const asset& recv)
|
|
|
|
|
{
|
|
|
|
|
auto r = create_sell_order(user(db), amount, recv);
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const limit_order_object* database_fixture::create_sell_order( const account_object& user, const asset& amount, const asset& recv )
|
|
|
|
|
{
|
|
|
|
|
limit_order_create_operation buy_order;
|
|
|
|
|
buy_order.seller = user.id;
|
|
|
|
|
buy_order.amount_to_sell = amount;
|
|
|
|
|
buy_order.min_to_receive = recv;
|
|
|
|
|
trx.operations.push_back(buy_order);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
auto processed = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
return db.find<limit_order_object>( processed.operation_results[0].get<object_id_type>() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
asset database_fixture::cancel_limit_order( const limit_order_object& order )
|
|
|
|
|
{
|
|
|
|
|
limit_order_cancel_operation cancel_order;
|
|
|
|
|
cancel_order.fee_paying_account = order.seller;
|
|
|
|
|
cancel_order.order = order.id;
|
|
|
|
|
trx.operations.push_back(cancel_order);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
auto processed = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
return processed.operation_results[0].get<asset>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::transfer(
|
|
|
|
|
account_id_type from,
|
|
|
|
|
account_id_type to,
|
|
|
|
|
const asset& amount,
|
|
|
|
|
const asset& fee /* = asset() */
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
transfer(from(db), to(db), amount, fee);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::transfer(
|
|
|
|
|
const account_object& from,
|
|
|
|
|
const account_object& to,
|
|
|
|
|
const asset& amount,
|
|
|
|
|
const asset& fee /* = asset() */ )
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
transfer_operation trans;
|
|
|
|
|
trans.from = from.id;
|
|
|
|
|
trans.to = to.id;
|
|
|
|
|
trans.amount = amount;
|
|
|
|
|
trx.operations.push_back(trans);
|
|
|
|
|
|
|
|
|
|
if( fee == asset() )
|
|
|
|
|
{
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
}
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (from.id)(to.id)(amount)(fee) )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_feed_producers( const asset_object& mia, flat_set<account_id_type> producers )
|
|
|
|
|
{ try {
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
asset_update_feed_producers_operation op;
|
|
|
|
|
op.asset_to_update = mia.id;
|
|
|
|
|
op.issuer = mia.issuer;
|
|
|
|
|
op.new_feed_producers = std::move(producers);
|
|
|
|
|
trx.operations = {std::move(op)};
|
|
|
|
|
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (mia)(producers) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::publish_feed( const asset_object& mia, const account_object& by, const price_feed& f )
|
|
|
|
|
{
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
|
|
|
|
|
asset_publish_feed_operation op;
|
|
|
|
|
op.publisher = by.id;
|
|
|
|
|
op.asset_id = mia.id;
|
|
|
|
|
op.feed = f;
|
|
|
|
|
if( op.feed.core_exchange_rate.is_null() )
|
|
|
|
|
op.feed.core_exchange_rate = op.feed.settlement_price;
|
|
|
|
|
trx.operations.emplace_back( std::move(op) );
|
|
|
|
|
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::force_global_settle( const asset_object& what, const price& p )
|
|
|
|
|
{ try {
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
asset_global_settle_operation sop;
|
|
|
|
|
sop.issuer = what.issuer;
|
|
|
|
|
sop.asset_to_settle = what.id;
|
|
|
|
|
sop.settle_price = p;
|
|
|
|
|
trx.operations.push_back(sop);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (what)(p) ) }
|
|
|
|
|
|
|
|
|
|
operation_result database_fixture::force_settle( const account_object& who, asset what )
|
|
|
|
|
{ try {
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
asset_settle_operation sop;
|
|
|
|
|
sop.account = who.id;
|
|
|
|
|
sop.amount = what;
|
|
|
|
|
trx.operations.push_back(sop);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
const operation_result& op_result = ptx.operation_results.front();
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
return op_result;
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (who)(what) ) }
|
|
|
|
|
|
|
|
|
|
const call_order_object* database_fixture::borrow(const account_object& who, asset what, asset collateral)
|
|
|
|
|
{ try {
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
call_order_update_operation update;
|
|
|
|
|
update.funding_account = who.id;
|
|
|
|
|
update.delta_collateral = collateral;
|
|
|
|
|
update.delta_debt = what;
|
|
|
|
|
trx.operations.push_back(update);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
|
|
|
|
|
auto& call_idx = db.get_index_type<call_order_index>().indices().get<by_account>();
|
|
|
|
|
auto itr = call_idx.find( boost::make_tuple(who.id, what.asset_id) );
|
|
|
|
|
const call_order_object* call_obj = nullptr;
|
|
|
|
|
|
|
|
|
|
if( itr != call_idx.end() )
|
|
|
|
|
call_obj = &*itr;
|
|
|
|
|
return call_obj;
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (who.name)(what)(collateral) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::cover(const account_object& who, asset what, asset collateral)
|
|
|
|
|
{ try {
|
|
|
|
|
set_expiration( db, trx );
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
call_order_update_operation update;
|
|
|
|
|
update.funding_account = who.id;
|
|
|
|
|
update.delta_collateral = -collateral;
|
|
|
|
|
update.delta_debt = -what;
|
|
|
|
|
trx.operations.push_back(update);
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (who.name)(what)(collateral) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::fund_fee_pool( const account_object& from, const asset_object& asset_to_fund, const share_type amount )
|
|
|
|
|
{
|
|
|
|
|
asset_fund_fee_pool_operation fund;
|
|
|
|
|
fund.from_account = from.id;
|
|
|
|
|
fund.asset_id = asset_to_fund.id;
|
|
|
|
|
fund.amount = amount;
|
|
|
|
|
trx.operations.push_back( fund );
|
|
|
|
|
|
|
|
|
|
for( auto& op : trx.operations ) db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::enable_fees()
|
|
|
|
|
{
|
|
|
|
|
db.modify(global_property_id_type()(db), [](global_property_object& gpo)
|
|
|
|
|
{
|
Hotfix/remove smart ref (#396)
* Merge develop into beatrice (#386)
* Fix building on Ubuntu 18.04 with GCC 7
* Peerplays SON plugin skeleton (#122)
* Peerplays SON plugin skeleton
* SON tests skeleton
* Part two of SON-83 - plugins option in command line and config file (#126)
- Empty SON plugin is INACTIVE by default
- To enable it, add peerplays_sidechain to plugins section in
config file, or use --plugins command line option
- Plugin can work with or without witness
* SON11 - Add chain extension parameter to set SON count
* [SON-107] Merge develop branch to SONs-base (#166)
* fix rng and get_winner_numbers implemented
* coipied code for bitshares fixing 429 and 433 isuues
* ticket_purchase_operation implemented. added lottery_options to asset
* lottery end implemented
* minor logic changes. added db_api and cli_wallet methods
* fix reindex on peerplays network
* fix some tests. add gitlab-ci.yml
* add pull to gitlab-ci
* fix
* fix and comment some tests
* added owner to lottery_asset_options. commented async call in on_applied_block callback
* added get_account_lotteries method to db_api and cli, lottery end_date and ticket_price verification
* merge get_account_lotteries branch. fix create_witness test
* fix test genesis and end_date verification
* fixed indices sorting and lottery end checking by date
* update db_version for replay and removed duplicate include files
* Added ntp and upgraded boost version
* Revert "GPOS protocol"
* need to remove backup files
* virtual-op-fix for deterministic virtual_op number
* Merged beatrice into 5050
* Updated gitmodules, changes to allow voting on lottery fee
* Removed submodule libraries/fc
* Added libraries/fc
* added missing , in types.hpp
* Added sweeps parameters to parameter_extension
* added missing comma in operations.hpp, small changes to config.hpp
* fixed returntype in chain_parameters.hpp
* removed sweeps_parameter_extensions
* Changed fc library
* fixed asset_object
* Changed peerplays-fc submodule
* Changed fc submodule to ubuntu 18.04 upgrade
* Removed submodule libraries/fc
* Added fc library back
* fix casting in overloaded function
* Removed blind_sign and unblind_signature functions
* Added new lottery_asset_create_operation
* Changed sweeps hardfork time
* Removed redundant if from asset_evaluator and fixed db_notify
* fixed duplicate code in fee_tests
* removed redundant tgenesis file
* Enable building on Ubuntu 18.04 using GCC 7 compiler
* fix: is_benefactor_reward had the default value of true when not set
* Docker file for Ubuntu 18.04
Base image updated to Unbuntu 18.04
Prerequisite list updated
Basic configuration updated
* Quick fix: Added missing package pkg-config
* Docker file updates
* 5050 fee update and compilation error fix
* Dockerfile, set system locale
Prevents locale::facet::_S_create_c_locale name error
* Update README.md
Fix typo
* Update README.md
* Changed hardfork time for SWEEPS and Core-429
* revert master changes that were brought in previous commit
* Fixed error when account_history_object with id 0 doesnt exist
* Fixed error while loading object database
* test for zero id object in account history
* Reorder operations in Dockerfile, to make image creation faster
- Reorder prevents unnecessary building of Boost libraries
* Fix for irrelevant signature included issue
* fix copyrigth messages order
* remove double empty lines
* Backport fix for `get_account_history` from https://github.com/bitshares/bitshares-core/pull/628 and add additional account history test case
* NTP client back
* GRPH-53-Log_format_error
* Merge pull request #1036 from jmjatlanta/issue_730
Add fail_reason to proposal_object
* Unit test case fixes and prepared SONs base
* Use offsetof instead of custom macro
* Hide some compiler warnings
* Make all the tests compile
* Add nullptr check in api.cpp for easier testing
* Add test case for broadcast_trx_with_callback API
* Unit test case fixes and prepared SONs base
* Merge pull request #714 from pmconrad/json_fix
JSON fix
* Increase max depth for trx confirmation callback
* Adapt to variant API with `max_depth` argument
* Update fc submodule
* Created unit test for #325
* remove needless find()
* GRPH-4-CliWallet_crash_ctrlD
* fix copyright message
* Make all the tests compile
* increase delay for node connection
* Increase block creation timeout to 2500ms
* remove cache from cli get_account
* add cli tests framework
* Adjust newly merged code to new API
* Improved resilience of block database against corruption
* Merged changes from Bitshares PR 1036
* GRPH-76 - Short-cut long sequences of missed blocks
Fixes database::update_global_dynamic_data to speed up counting missed blocks.
(This also fixes a minor issue with counting - the previous algorithm would skip missed blocks for the witness who signed the first block after the gap.)
* Moved reindex logic into database / chain_database, make use of additional blocks in block_database
Fixed tests wrt db.open
* Enable undo + fork database for final blocks in a replay
Dont remove blocks from block db when popping blocks, handle edge case in replay wrt fork_db, adapted unit tests
* Log starting block number of replay
* Prevent unsigned integer underflow
* Fixed lock detection
* Dont leave _data_dir empty if db is locked
* Writing the object_database is now almost atomic
* Improved consistency check for block_log
* Cut back block_log index file if inconsistent
* Fixed undo_database
* Added test case for broken merge on empty undo_db
* Merge pull request #938 from bitshares/fix-block-storing
Store correct block ID when switching forks
* exclude second undo_db.enable() call in some cases
* Add missing change
* change bitshares to core in message
* Fixed integer overflow issue
* Fix for for history ID mismatch ( Bitshares PR #875 )
* Update the FC submodule with the changes for GRPH-4
* Fix #436 object_database created outside of witness data directory
* supplement more comments on database::_opened variable
* prevent segfault when destructing application obj
* Fixed duplicate ops returned from get_account_history
* minor performance improvement
* Added comment
* Merged Bitshares PR #1462 and compilation fixes
* Support/gitlab (#123)
* Updated gitlab process
* Fix undefined references in cli test
* Fixed test failures and compilation issue
* Fixed account_history_pagination test
* Fix compilation in debug mode
* Removed unrelated comment
* Skip auth check when pushing self-generated blocks
* Extract public keys before pushing a transaction
* Dereference chain_database shared_ptr
* Updated transaction::signees to mutable
and
* updated get_signature_keys() to return a const reference,
* get_signature_keys() will update signees on first call,
* modified test cases and wallet.cpp accordingly,
* no longer construct a new signed_transaction object before pushing
* Added get_asset_count API
* Allow sufficient space for new undo_session
* Throw for deep nesting
* No longer extract public keys before pushing a trx
and removed unused new added constructor and _get_signature_keys() function from signed_transaction struct
* Added cli_test to CI
* use random port numbers in app_test (#154)
* proposal fail_reason bug fixed (#157)
* Added Sonarcloud code_quality to CI (#159)
* Added sonarcloud analysis (#158)
* fix for lottery end
* fix declarations
* fix declarations
* fix boost integer
* fix compilation
* fix chain tests
* fix app_test
* try to fix cli test
* fix incorrect max_depth param
* working cli test
* correct fc version
* Revert "[SON-107] Merge develop branch to SONs-base (#166)"
This reverts commit 499e3181990d7b732459a38263a6039703c94720.
* Fix build error, add missing GRAPHENE_MAX_NESTED_OBJECTS parameter
* Plugin description added, SON plugin params example
* fix for cli test
* SON object, operations, cli_wallet commands and RPC (#160)
- create_son, update_son, delete_son, list_sons
- get_sons, get_son_by_account, lookup_son_accounts, get_son_count
- vote_for_son, update_son_votes
- claim_registered_son
- get_son in cli_wallet
- Updating global_property_object
- Decrease SON hardfork time for test purposes
- CLI Wallet tests imported from develop branch
* fix affiliate tests
* SON-108 - Add cli wallet tests for create_son (#174)
* SON-108 - Add cli wallet tests for create_son
* Add info message at the beginning and end of the SON CLI tests
* Minor output message change
* Enable Boost test messages in unit tests
* [SON-110] get_son cli test (#173)
* get_son cli test
* update_son cli test
* Add cli wallet tests for vote_for_son (#175)
* fix insert object processing in indexes, son_delete is working
* Fix segfault when using delete_son from cli_wallet (#177)
* Fix segfault when using list_sons from cli_wallet (#178)
* Add son_delete cli tests (#182)
* Add son_delete cli tests
* add son vesting config options
* add vesting balance type support
* add dormant vesting policy for son
* add precision to son vesting amount
* SON118-Add Budget for SON (#165)
* SON118-Add Budget for SON
* SON118 - Compilation errors fix
* SON118 - Proper commenting around pay_sons function
* SON118 - Comment correction, SON statistics object implementation type correction
* SON118 - Add missing index init and reflect enums
* SON118 - Correcting the indentation
* SON118 SON144 - Add unit test, code fixes and resolve failures for existing tests
* SON118 SON144 - Removing extra spaces added
* abstraction of dormant vesting policy
* force son create vesting balance to have dormant policy
* remove not needed code from wallet son commands, add delete son test to cli (#181)
* Active SONs, list up to 15, order by votes, add test (#185)
* Add test for selecting 15 SONs with highest votes
* Display up to 15 active SONs, SON ordering by total_votes
* fix build error (#191)
* fix build error
* adapt son_pay_test to dormant vesting policy
* [SON-113] Unit test for cli `update_son_votes` (#179)
* refactor cli tests
* update_son_votes tests
* list_sons test
* test changes in get_global_properties() result
* fix generate_block failure
* fix update_son_votes test
* improve update_son cli test
* fix linking errors
* refactor select_top_fifteen_sons test
* refactor other son cli tests to use son_test_helper
* create_vesting call in wallet_api
* test fix
* fix create_son in wallet_api and cli tests
* SON126 - Witness Proposals to deregister SONs (#192)
* SON126 - Witness Proposals to deregister SONs
* SON126 - Approval by witness, removal of son_proposal_object, commenting
* SON126 - Witness proposal tests and related fixes
* SON126 - Proper commenting
* fix son_delete_operation reflection
* [SON-160] Fix create_vesting wallet_api call (#206)
* Fix create_vesting wallet_api call
* change type for vesting_type in create_vesting_balance
* [SON-113] Fix several issues in update_son_votes call in wallet_api (#208)
* do not allow update votes with both empty lists
* fix error messages
* check number of sons against votes number in account_object
* Update error message
* list_active_sons api call implementation
* unit test for list_active_sons
* fix code style
* use assert instead of checking condition with low possibility
* Fixed betting tests (#217)
* Fixed betting tests
* Removed comments
* removed unrelated parameter description from delete_son
* Add Bitcoin network listener to a SON plugin (#196)
* Add Bitcoin network listener to a SON plugin
* Add default parameters for Peerplays Bitcoin test node
* Add Bitcoin block processing
* Update source code to last designs
* Set default parameters for peerplays_sidechain plugin to Bitcoin test server
* WIP: Some Bitcoin transaction processing
* [SON-199] Fix unit tests (#233)
* fix app_test
* fix son_delete_test
* Add peerplays account for a SON in a config/command line options (#231)
* SON193-SON200- SON Heartbeats and maintenance mode changes (#241)
* SON193-SON200- SON Heartbeats and maintenance mode changes
* SON193-SON200- SON Heartbeats and maintenance tests
* User sidechain address mappings (#240)
* WIP: Sidechain objects
* Revert "WIP: Sidechain objects"
This reverts commit 8676940a281604688771e96ceb1e65a35d98e8e5.
* WIP: User sidechain address mappings
* Fix reflection problem
* Reflect missing members of sidechain_address_update_operation
* Add sidechain address operation tests
* Enable RPC calls
* Fix build errors due to merge conflict
* Fix RPC, add CLI wallet commands for sidechain addresses
* Improved peerplays_sidechain_plugin_impl
* Remove short param for son-id
* Fix crashing errors on bitcoin event received
* Code review changes
* SON207 - Introduce scheduling for SONs similar to witnesses (#251)
* Extend SON objects to contain sidechain public keys (#254)
* SON194-SON195 - Report SON Down, addition of SON Account for sidechain consensus (#244)
* SON194-SON195 - Addition of SON BTC Account and report son down changes
* SON194-SON195 - SON BTC Account errors rectification
* SON194-SON195 - Adding Tests
* User sidechain address mappings (#240)
* WIP: Sidechain objects
* Revert "WIP: Sidechain objects"
This reverts commit 8676940a281604688771e96ceb1e65a35d98e8e5.
* WIP: User sidechain address mappings
* Fix reflection problem
* Reflect missing members of sidechain_address_update_operation
* Add sidechain address operation tests
* Enable RPC calls
* Fix build errors due to merge conflict
* Fix RPC, add CLI wallet commands for sidechain addresses
* Improved peerplays_sidechain_plugin_impl
* Remove short param for son-id
* Fix crashing errors on bitcoin event received
* Code review changes
* SON207 - Introduce scheduling for SONs similar to witnesses (#251)
* Extend SON objects to contain sidechain public keys (#254)
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
* SON206 - Plugin SON Heartbeat changes (#250)
* SON206 - Plugin SON Heartbeat changes
* SON206 - Plugin SON Heartbeat changes, comment removal
* SON206 - Plugin SON Heartbeat changes, stub testing and changes
* SON206 - Plugin SON Heartbeat changes, removing debugs prints
* Wallet recreation on new set of SONs voted in (#256)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* Fix build errors
* SON212-SON213 - Add Sidechain Plugin Code to report and approve SON Down proposal (#260)
* SON212 - Add Sidechain Plugin Code to report SON Down
* SON212-SON213 - Add Sidechain Plugin Code to report SON Down, Approve proposal from sidechain plugin
* SON212-SON213 - Fix Build Error (#262)
* SON212-SON213 - Fix Build Error
* SON212-SON213 - Fix Build Error Add smart_ref definition for linking
* Updated gitlab CI to sync submodules (#265)
* SON217 - SON Maintenance,Heartbeat state transition changes (#264)
* SON217 - SON Maintenance,Heartbeat state transition changes
* SON217 - SON Maintenance,Heartbeat state transition changes
* [SON-202] Implement cli_wallet commands for maintenance mode (#261)
* Add stop_son_maintenance CLI call
* fix bug with SON activation
* son_maintenance_operation
* son_maintenance_operation tests
* cli test for son maintenance state
* start_son_maintenance CLI call
* keep maintenance state during active SON set changes
* Quick fix for list_active_sons
* SON199 - Fix Unit Test Failure (#268)
* Quickfix for update_sidechain_address and delete_sidechain_address cli commands
* SON206_Plugin_CrashFix_Reorg - Plugin Changes (#272)
* SON206_Plugin_CrashFix_Reorg - Plugin Changes
* SON206_Plugin_CrashFix_Reorg - add owner auths to consensus account
* SON165 - Keys mapping missing from wallet data (#274)
* SON232 - Avoid duplicate proposals from sidechain plugin (#275)
* SON233 - Provide correct downtime metrics to user (#278)
* son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
* SON214 - Request maintenance wallet commands (#280)
* SON wallet transfer object and operations (#279)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add is_active_son guards for sidechain events processing
Co-authored-by: gladcow <jahr@yandex.ru>
* Support multiple SON nodes per software instance (#282)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Temoprary disable account history tests for tracking accounts
Co-authored-by: gladcow <jahr@yandex.ru>
* [SON-209] Create P2SH address with custom redeemScript (#271)
* Create redeem script for SONs primary wallet
* Add importaddress call
Allows to watch for related transactions without private keys import
* Get UTXO set for watched addresses
* createrawtransaction call
* signing PW spending transaction
* unit test for btc tx serialization
* sending PW transfer in test
* BIP143 tx signing
* use bech32 address format
* use single sha256 for lock script
* Digest fix
* working signing
* separate signing
* test partially signed PW transfer
* add ability to gather signatures before signing (#290)
* [SON-242] fix list_active_sons call after deleting an active son (#292)
* test to reproduce error in list_active_sons after delete_son
* prevent exception in list_active_list
* [SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
* SON261 - Bitcoin deposit, withdrawal, PW transfer (#287)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* SON261 - Deposit transfer ( user address -> PW ) and Withdrawal transfer ( PW -> user address ) for m-of-n multisig
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* SON261 - Withdrawal transfer ( PW -> user address ), addition of bitcoin public private key to config.ini for multiple sons mode
* Withdrawal refactoring
* Withdrawal refactoring
* SON261 - Fix prepare_tx
* SON261 - Add PW->PW Transfer and Code reorg
* Fix file permissions
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: gladcow <jahr@yandex.ru>
* [SON-264] Integrating deposit/withdrawals with bitcoin transactions (feature/SON-260 + SON261 branches) (#291)
* Partial integration done, some Bitcoin RPC refactoring
* CLang Format config file
* CLang Format config file v2.0
* Fix repeating tasks that should be executed by scheduled SON only
* Fix withdrawal
* Integrate PW wallet fund moving
* Resolve conflicts
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: satyakoneru <satyakoneru.iiith@gmail.com>
* SON200 - SON Down proposal broken after latest merges (#294)
* SON200 - SON Down proposal broken after latest merges
* Add the owner weight threshold similar to witnesses and committee accounts
* SON269 - Move SON deregistration to Plugin from witness (#298)
* SON200 - SON Down proposal broken after latest merges
* Add the owner weight threshold similar to witnesses and committee accounts
* SON269 - Move SON deregistration to Plugin from witness
* Various SON improvements (#297)
* Refactor SON processing
* Better exposure of sidechain private keys in sidechain handlers
* Support non default Bitcoin wallets
* Fix crash on config file recreation
* clang-format formatting
* New Bitcoin wallet related RPC calls
* Add missing create_son_deregister_proposals calls
* Add missing create_son_deregister_proposals calls
* Add loading/unlocking/locking of non-default bitcoin wallet
* Bitcon RFC logs improved, proposal aprovement improved
* Move signal connection after handlers are created
* Merge develop into SONS
* SON118 - Add tx sign metrics for SON rewards (#302)
* resolved compilation issues and other conflicts
* SON202 - Maintenance improvements (#303)
* Quickfix, remove dead code, return result from wallet withdraw do_evaluate
* SON275 - ZMQ Crash on application exit (#306)
* SON275 - ZMQ Crash on application exit
* SON275 - Fix Indentation
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* need to assign both name and id to stats id
* fix unit test case failures(add gpos vesting before voting)
* SON276 - Fix SON proposal exceptions - I (#307)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Add SON statistic for tracking reported sidechain transactions (#308)
- Deposit and Withdrawal object extended to contain expected
and received transaction reports from SON network
- SON statistic object extended to contain total number of
sidechain transactions reported by SON network when SON was
active and number of transactions reported by single SON when
he was active
- Code formatting
* Allow voting for son, only if GPOS vesting balance available
* notifications of SONS should get restrict to sons functionality
* update GPOS hardfork date to sons branch
* SON127 - Add son parameter extensions to genesis, push proposal fix (#310)
* SON276 - Fix SON proposal exceptions - I
* SON127 - Add son parameter extensions to genesis, push proposal fix
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* update GPOS HF to fall in before SONS HF, remove check
* updated unit test cases to reflect GPOS vesting and update account id's according to sons-account
* [SON-24] - SON Rewards missing serialisations and end to end testing (#313)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Revert "Merge develop branch changes(GPOS+graphene updates) into SONs branch"
* [SON-122] - SON Statistics improvements and consensus account creation (#318)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Replace raw with psbt transactions to support parital tx signing (#311)
* RPC calls for PSBT, raw transactions replaced with PSBT
* Fix estimatesmartfeerate, extensive RPC calls logging for debugging purposes
* Remove dead code
* Partial signing functional for deposit and withdrawal
* Fix sidechain_type declarations
* Depositing Peerplays asset refactored
* Partial signing functional for primary wallet funds moving
* Prettier logs
* Refactor multiple SON support processing
* Serialize field complete from sidechain_transaction_sign_operation
* Refactor transaction signing in particular order, BTC only (maybe) need it
* Add number of required signatures parameter for addmultisigaddress
* Change default bitcoin node parameters
* Transaction signing only by scheduled son
* Removed scheduling log
* Prevent PW funds moving to the same address
* Refactor sidechain_transaction_object processing, code cleanup
* Remove obsolete tests
* Decrease logging
* Code readability
* When updated, import son wallet bitcoin address to bitcoin wallet
* When updated, recreate son wallet bitcoin address on each node
* Refactor on_changed_objects, move it into task
* Add check to prevent deposit/withdrawal double processing
* Improved check for sidechain transaction object creation
* Single sidechain transaction signature per block allowed only
* Unlock wallet on addmultisigaddress
* Import both address and redeem script on primary wallet change, fix some compiler warnings
* Fix invalid list of signers for PW funds transfer
* [SON-312] Refactor create_son to assign owner account public key as a signing_key
remove key derivation from create son (#323)
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* [SON-271] Merge recent develop branch changes(both GPOS and graphene updates) into SONs branch (#322)
* Parallelizing sidechain transaction signing (#319)
* [SON-321, SON-323] Deposit/Withdraw object creation refactoring (#320)
* Remove proposals for creating deposit and withdrawal objects, strenghten evaluator checks
* Only active SON can create the object
* Only expected SON can confirm the transaction
* Transaction must be initiated (paid) by SON account owner (SON account given in operation)
* Transaction confirmation must contain exactly the same data as existing object
* Mirror SON owner account weights from son-account.active.account_auths to active SONs
* Fix duplicated typedef, peerplays_sidechain::sidechain_type to chain::sidechain_type
* Add missing serialized field
* [SON-318_SON-319] - Add approval checks for son down, deregister proposals (#321)
* [SON-318_SON-319] - Add approval checks for son down and deregister proposals
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
* [SON-311] Add try_create_son call without explicit deposit params (#324)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - Fix build error
* Quickfix - change GPOS and SON hardfork times
* [SON-332] Check gitlab building process for dirty build (#327)
* Fix failing son test, fix data types and check condition
* Very clean build on Gitlab
* update son-account parameters (#328)
* [SON-329] Hotfix - Enable test test_update_dividend_interval
* [SON-313] - Limit SON functionality when min no. of sons are not present (#329)
* [SON-313] - Limit SON functionality when min no. of sons are not present
* Revert SON HF related checks and tests
* Remove the capability to process proposals in plugin
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-307] Create PBTC asset (#326)
* SON-297_SON-336 - SON vesting functionality broken after graphene merge (#331)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Hotfix - add initialization values to extension params, remove trailing spaces
* [SON-305, SON-308, SON-310] Use BTC asset in bitcoin deposits and withdraws (#332)
* [SON-339] - SON Schedule crash (#334)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-291,SON-328] - SON Configuration invalid, PW creation issues (#335)
* [SON-291,SON-328] - SON Configuration invalid, PW creation issues
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-322, SON-324] Approval checks for processing deposit/withdrawal (#330)
* Refactor proposal processing
* Added check for approving son_wallet_deposit_process_operation
* Added check for approving son_wallet_withdraw_process_operation
* Calculating exchange rates fixed
* Fix depositing Peerplays assets
* [SON-320] Added check for approving son_wallet_update_operation (#336)
* [SON-325] Added check for approving sidechain_transaction_create_operation (#337)
* [SON-341, SON-342] Fix issue with deposits number (#339)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* [SON-344] BTC asset is created with wrong quote asset id, Fixed (#341)
* [SON-344] BTC asset is created with wrong quote asset id, Fixed
* Respond to code review
* [SON-346] Sidechain transaction marked as complete even though current_weight < threshold, Fixed (#342)
* [SON-348] Transaction hash not saved in object after Bitcoin transaction is sent (#343)
- Fixed
- Unused parameters removed
* [SON-337] - Prevent update_son_votes without GPOS vesting (#344)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-353] Refactor PW processing, PW transfer fixed (#347)
* Add proposal checks for deposit and withdrawal
* Refactor proposal approvement
* Fix transaction verification
* Remove logs
* [SON-354] Fix son_info compare function (#350)
* check object's id (#351)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* SON Weighted Multi Signature Signing (#349)
* Bring in the bitcoin utils code into plugin
* Add tx creation, signing and tests
* tx deserialization fix
* add 10-of-14 multisig address test
* Add signing and verification tests and sign_transaction_standalone
* Add send_transaction_standalone function
* Debug logs and additional tests
* Fix for son deletion in the middle
* Extend script_builder
* Witness script for weighted wallet
* btc_weighted_multisig_address implementation
* Fix for bad-txns-nonstandard-inputs
* Weighted multisignature address test
* Create test tx with weighted multisig wallet
* Fix the issues with tx signing
* End to End test weighted multi sig
* 1 or m-of-n deposit address support
* Move network_type enum to the base class
* btc_one_or_weighted_multisig_address implementation
* Simplify redeem script
* Fix error in redeem_script
* btc_one_or_weighted_multisig_address tests
* Refactor sidechain address mapping
* CLANG code format
* CLANG code format sidechain tests
* Integration of deposit and rest of weighted wallets, withdrawal fee fix, whole code refactoring
* Move util functions to Utils file
* Add proper checks for withdraw fee
* Deposit address creation, import deposit/withdraw addresses, some code cleanup
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
* [SON-349] Delay BTC asset issue/reserve until tx confirmed on sidchain (#348)
* Separate transaction settling from deposit/withdrawal processing
* Handle peerplays deposits with transaction settling
* Remove logs
* All dev features enabled/disabled with single flag
* Deposit/withdraw process and sidechain transaction creation in single proposal
* Hotfix - remove importing sidechain addresses
* Hotfix - remove redundant deposit sidechain address recreation
* private-key option update
* Use decoderawtraction json for proposal approvals (#352)
* Use decoderawtraction json for proposal approvals
* Use default null string to get first vout
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Prevent incorrect signatures to be added to transaction (#354)
* Prevent incorrect signatures to be added to transaction
* Check signers list before signing
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Hotfix - use getrawtransaction for approvals and settling (#355)
* Revert "Use decoderawtraction json for proposal approvals (#352)"
This reverts commit d3385b28cb75bbf43ff6fbcccee404d2183ff8a7.
* User getrawtransaction for proposal approvals and settling
* Code cleanup
* [SON-135] Add timelock to user deposit address (#356)
* timelocks
* timelocked deposit address
* test for deposit timelock
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - fix threshold_weight calculation in redeem scripts
* fix broken peerplays_sidechain tests (#357)
Co-authored-by: gladcow <s.gladkov@pbsa.info>
* Hotfix - Save deposit address redeem and witness script into sidechain address object
* [SON-359] - Fix Errors processing to-be-refunded deposits (#358)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* [SON-363] - Remove son deletion (#359)
* [SON-363] - Remove son deletion
* Fix the tests
* [SON-314] - Weighted Rewards and equal weighted son-account (#360)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Bitcoin network type deduction (#361)
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* chore: changed building to debug mode
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* chore: updated Dockerfile with dnsutils
* GPOS2 HF - Handle rolling period on missing blocks (#369)
* Mainnet chain halt 5050 Issue (#370)
* Peerplays Marketplace + NFT (#367)
* ppy marketplace 1 - add evaluators and objects
* NFT object and basic operations
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* NFT evaluators and basic tests, no evaluator checks
* Evaluator checks in place
* ppy marketplace 2 - batch sale, offer_object escrow
* Database API
* Wallet API
* NFT metadata implemented
* Fix NFT tests
* Database API for NFT metadata and enumerables
* ppy marketplace 4 - Add tests NFT+Marketplace
* ppy marketplace 5 - Add revenue split
* ppy marketplace 6 - Remove unnecessary files
* ppy marketplace 7 - Add db, wallet changes and some NFT fixes
* ppy marketplace 8 - Add pagination for list APIs
* New DB API, list all NFTs, list NFTs by owner
* Marketplace + NFT + RBAC (#368)
* rbac1 - evaluators and op validators added
* rbac2 - op_type hf checks
* rbac3 - tx auth verify changes
* Update .gitlab-ci.yml
* rbac4 - basic op tests
* rbac5 - clear expired and deleted permission linked auths
* rbac6 - more tests
* rbac7 - more tests
* rbac8 - more tests
* rbac9 - wallet and db api changes
* rbac10 - db api changes for required signature fetch
* rbac11 - add db_api tests
* rbac12 - add missing code for key auths
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
* Fix nft_get_token_uri returning empty string
* Fix nft_mint_evaluator to save token_uri
* Fix cli_wallet to properly pass metadata id for nft_create
* ppy marketplace 9 - FC_REFLECT offer create op
* Add stricter checks to NFTs
* Unlisting offers, add result in offer history object
* Reverting genesis.json wrong commit
* Add non-transferable non-sellable properties to NFTs
* Review comments - change variable names, use scoped enums
* nft_metadata_update changes
* NFT HF checks and op fee addition changes
* NFT make revenue_split integer from double
* revenue_split condition check allow zero or above
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
* Son deposit address enhancements (#362)
* Deposit address enhancements
* fix tests
Co-authored-by: Koneru Satyanarayana <15652887+satyakoneru@users.noreply.github.com>
* Ws updates
* Fix for custom operation authority checking (BTS Issue #210) (#382)
* Resolve #210: [HF] Check authorities on custom_operation
The required_auths field on custom_operation was being ignored during authority checking. This commit causes it to be checked correctly, and adds a unit test verifying as much.
* Ref #381: Fixes
Build and logic fixes for Pull Request #381
* Ref #381: Fix bad merge
During merge conflict resolution, I accidentally broke custom
authorities. This fixes it.
* compilation fix
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
* Cleanup changes for pretier diff
* Cleanup changes for prettier diff
* NFT Permissions (#380)
* Account Roles Permission 1 - Working code with tests
* Account Roles Permission 2 - Add marketplace offer/bid tests
* Account Roles Permission 3 - Add Op check
* Account Roles Permission 4 - Add chain params and limits
* Cleanup changes for prettier diff
* Fix failing saving_keys_wallet_test
* Fix failing saving_keys_wallet_test
* Align submodule versions
* Add missing break
* Increase tests log_level, some cleanup
* Decrease log level for tests
* Fix block_tests/maintenance_interval test
* Fix son_operation_tests/son_pay_test test
* Remove base_uri length checks
* Fix HF info
Co-authored-by: S <obucinac@gmail.com>
Co-authored-by: Bobinson K B <bobinson@gmail.com>
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: satyakoneru <satyakoneru.iiith@gmail.com>
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Sandip Patel <sandip@knackroot.com>
Co-authored-by: Roshan Syed <r.syed@pbsa.info>
Co-authored-by: pbattu123 <p.battu@pbsa.info>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: blockc p <pravin.blockc@gmail.com>
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
* SON hardfork time to Saturday, October 17, 2020 00:00:00 UTC
* hotfix - chain params variable overflow, rbac hf check (#387)
* hotfix - son max count fix
* init variables
* Update SON HF time to October 20th 2020, 00:00:00
* Update SON HF time to October 20th 2020, 00:00:00
* Release build fix, missing includes (#391)
fixes https://github.com/peerplays-network/peerplays/issues/390
* Fix release build on 18.04, fc::smart_ref_* removed
* Gitlab will build Debug and Release versions
* Revert "Gitlab will build Debug and Release versions"
This reverts commit 7a721f8094e264417aa8519ca90e68f2b23aeebc.
* Gitlab will build Release version only
* add safe copy
* verify_transaction proper value
* proper init of publick_key
Co-authored-by: serkixenos <70147861+serkixenos@users.noreply.github.com>
Co-authored-by: S <obucinac@gmail.com>
Co-authored-by: Bobinson K B <bobinson@gmail.com>
Co-authored-by: obucinac <obucinac@users.noreply.github.com>
Co-authored-by: gladcow <jahr@yandex.ru>
Co-authored-by: gladcow <s.gladkov@pbsa.info>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Sandip Patel <sandip@knackroot.com>
Co-authored-by: Roshan Syed <r.syed@pbsa.info>
Co-authored-by: pbattu123 <p.battu@pbsa.info>
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: Satyanarayana Koneru <skoneru@SK-GT.local>
Co-authored-by: blockc p <pravin.blockc@gmail.com>
Co-authored-by: Nathan Hourt <nathan@followmyvote.com>
Co-authored-by: Serki <serki.xenos@gmail.com>
2020-10-22 18:03:46 +00:00
|
|
|
gpo.parameters.current_fees = std::make_shared<fee_schedule>(fee_schedule::get_default());
|
2017-05-25 09:13:59 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::upgrade_to_lifetime_member(account_id_type account)
|
|
|
|
|
{
|
|
|
|
|
upgrade_to_lifetime_member(account(db));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::upgrade_to_lifetime_member( const account_object& account )
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
account_upgrade_operation op;
|
|
|
|
|
op.account_to_upgrade = account.get_id();
|
|
|
|
|
op.upgrade_to_lifetime_member = true;
|
|
|
|
|
op.fee = db.get_global_properties().parameters.current_fees->calculate_fee(op);
|
|
|
|
|
trx.operations = {op};
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
FC_ASSERT( op.account_to_upgrade(db).is_lifetime_member() );
|
|
|
|
|
trx.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
}
|
|
|
|
|
FC_CAPTURE_AND_RETHROW((account))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::upgrade_to_annual_member(account_id_type account)
|
|
|
|
|
{
|
|
|
|
|
upgrade_to_annual_member(account(db));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::upgrade_to_annual_member(const account_object& account)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
account_upgrade_operation op;
|
|
|
|
|
op.account_to_upgrade = account.get_id();
|
|
|
|
|
op.fee = db.get_global_properties().parameters.current_fees->calculate_fee(op);
|
|
|
|
|
trx.operations = {op};
|
|
|
|
|
db.push_transaction(trx, ~0);
|
|
|
|
|
FC_ASSERT( op.account_to_upgrade(db).is_member(db.head_block_time()) );
|
|
|
|
|
trx.clear();
|
|
|
|
|
verify_asset_supplies(db);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW((account))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::print_market( const string& syma, const string& symb )const
|
|
|
|
|
{
|
|
|
|
|
const auto& limit_idx = db.get_index_type<limit_order_index>();
|
|
|
|
|
const auto& price_idx = limit_idx.indices().get<by_price>();
|
|
|
|
|
|
|
|
|
|
cerr << std::fixed;
|
|
|
|
|
cerr.precision(5);
|
|
|
|
|
cerr << std::setw(10) << std::left << "NAME" << " ";
|
|
|
|
|
cerr << std::setw(16) << std::right << "FOR SALE" << " ";
|
|
|
|
|
cerr << std::setw(16) << std::right << "FOR WHAT" << " ";
|
|
|
|
|
cerr << std::setw(10) << std::right << "PRICE (S/W)" << " ";
|
|
|
|
|
cerr << std::setw(10) << std::right << "1/PRICE (W/S)" << "\n";
|
|
|
|
|
cerr << string(70, '=') << std::endl;
|
|
|
|
|
auto cur = price_idx.begin();
|
|
|
|
|
while( cur != price_idx.end() )
|
|
|
|
|
{
|
|
|
|
|
cerr << std::setw( 10 ) << std::left << cur->seller(db).name << " ";
|
|
|
|
|
cerr << std::setw( 10 ) << std::right << cur->for_sale.value << " ";
|
|
|
|
|
cerr << std::setw( 5 ) << std::left << cur->amount_for_sale().asset_id(db).symbol << " ";
|
|
|
|
|
cerr << std::setw( 10 ) << std::right << cur->amount_to_receive().amount.value << " ";
|
|
|
|
|
cerr << std::setw( 5 ) << std::left << cur->amount_to_receive().asset_id(db).symbol << " ";
|
|
|
|
|
cerr << std::setw( 10 ) << std::right << cur->sell_price.to_real() << " ";
|
|
|
|
|
cerr << std::setw( 10 ) << std::right << (~cur->sell_price).to_real() << " ";
|
|
|
|
|
cerr << "\n";
|
|
|
|
|
++cur;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string database_fixture::pretty( const asset& a )const
|
|
|
|
|
{
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << a.amount.value << " ";
|
|
|
|
|
ss << a.asset_id(db).symbol;
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::print_limit_order( const limit_order_object& cur )const
|
|
|
|
|
{
|
|
|
|
|
std::cout << std::setw(10) << cur.seller(db).name << " ";
|
|
|
|
|
std::cout << std::setw(10) << "LIMIT" << " ";
|
|
|
|
|
std::cout << std::setw(16) << pretty( cur.amount_for_sale() ) << " ";
|
|
|
|
|
std::cout << std::setw(16) << pretty( cur.amount_to_receive() ) << " ";
|
|
|
|
|
std::cout << std::setw(16) << cur.sell_price.to_real() << " ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::print_call_orders()const
|
|
|
|
|
{
|
|
|
|
|
cout << std::fixed;
|
|
|
|
|
cout.precision(5);
|
|
|
|
|
cout << std::setw(10) << std::left << "NAME" << " ";
|
|
|
|
|
cout << std::setw(10) << std::right << "TYPE" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "DEBT" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "COLLAT" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "CALL PRICE(D/C)" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "~CALL PRICE(C/D)" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "SWAN(D/C)" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "SWAN(C/D)" << "\n";
|
|
|
|
|
cout << string(70, '=');
|
|
|
|
|
|
|
|
|
|
for( const call_order_object& o : db.get_index_type<call_order_index>().indices() )
|
|
|
|
|
{
|
|
|
|
|
std::cout << "\n";
|
|
|
|
|
cout << std::setw( 10 ) << std::left << o.borrower(db).name << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << pretty( o.get_debt() ) << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << pretty( o.get_collateral() ) << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << o.call_price.to_real() << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << (~o.call_price).to_real() << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << (o.get_debt()/o.get_collateral()).to_real() << " ";
|
|
|
|
|
cout << std::setw( 16 ) << std::right << (~(o.get_debt()/o.get_collateral())).to_real() << " ";
|
|
|
|
|
}
|
|
|
|
|
std::cout << "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::print_joint_market( const string& syma, const string& symb )const
|
|
|
|
|
{
|
|
|
|
|
cout << std::fixed;
|
|
|
|
|
cout.precision(5);
|
|
|
|
|
|
|
|
|
|
cout << std::setw(10) << std::left << "NAME" << " ";
|
|
|
|
|
cout << std::setw(10) << std::right << "TYPE" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "FOR SALE" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "FOR WHAT" << " ";
|
|
|
|
|
cout << std::setw(16) << std::right << "PRICE (S/W)" << "\n";
|
|
|
|
|
cout << string(70, '=');
|
|
|
|
|
|
|
|
|
|
const auto& limit_idx = db.get_index_type<limit_order_index>();
|
|
|
|
|
const auto& limit_price_idx = limit_idx.indices().get<by_price>();
|
|
|
|
|
|
|
|
|
|
auto limit_itr = limit_price_idx.begin();
|
|
|
|
|
while( limit_itr != limit_price_idx.end() )
|
|
|
|
|
{
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
print_limit_order( *limit_itr );
|
|
|
|
|
++limit_itr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64_t database_fixture::get_balance( account_id_type account, asset_id_type a )const
|
|
|
|
|
{
|
|
|
|
|
return db.get_balance(account, a).amount.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64_t database_fixture::get_balance( const account_object& account, const asset_object& a )const
|
|
|
|
|
{
|
|
|
|
|
return db.get_balance(account.get_id(), a.get_id()).amount.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64_t database_fixture::get_dividend_pending_payout_balance(asset_id_type dividend_holder_asset_type,
|
2020-02-04 18:31:45 +00:00
|
|
|
account_id_type dividend_holder_account_id,
|
|
|
|
|
asset_id_type dividend_payout_asset_type) const
|
2017-05-25 09:13:59 +00:00
|
|
|
{
|
2020-02-04 18:31:45 +00:00
|
|
|
const pending_dividend_payout_balance_for_holder_object_index& pending_payout_balance_index =
|
2017-05-25 09:13:59 +00:00
|
|
|
db.get_index_type<pending_dividend_payout_balance_for_holder_object_index>();
|
2020-02-04 18:31:45 +00:00
|
|
|
auto pending_payout_iter =
|
2017-05-25 09:13:59 +00:00
|
|
|
pending_payout_balance_index.indices().get<by_dividend_payout_account>().find(boost::make_tuple(dividend_holder_asset_type, dividend_payout_asset_type, dividend_holder_account_id));
|
|
|
|
|
if (pending_payout_iter == pending_payout_balance_index.indices().get<by_dividend_payout_account>().end())
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return pending_payout_iter->pending_balance.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector< operation_history_object > database_fixture::get_operation_history( account_id_type account_id )const
|
|
|
|
|
{
|
|
|
|
|
vector< operation_history_object > result;
|
|
|
|
|
const auto& stats = account_id(db).statistics(db);
|
|
|
|
|
if(stats.most_recent_op == account_transaction_history_id_type())
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
const account_transaction_history_object* node = &stats.most_recent_op(db);
|
|
|
|
|
while( true )
|
|
|
|
|
{
|
|
|
|
|
result.push_back( node->operation_id(db) );
|
|
|
|
|
if(node->next == account_transaction_history_id_type())
|
|
|
|
|
break;
|
|
|
|
|
node = db.find(node->next);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
void database_fixture::process_operation_by_witnesses(operation op)
|
|
|
|
|
{
|
|
|
|
|
const flat_set<witness_id_type>& active_witnesses = db.get_global_properties().active_witnesses;
|
|
|
|
|
|
|
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = (*active_witnesses.begin())(db).witness_account;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(op);
|
|
|
|
|
proposal_op.expiration_time = db.head_block_time() + fc::days(1);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back(proposal_op);
|
|
|
|
|
set_expiration(db, tx);
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
processed_transaction processed_tx = db.push_transaction(tx);
|
|
|
|
|
proposal_id_type proposal_id = processed_tx.operation_results[0].get<object_id_type>();
|
|
|
|
|
|
|
|
|
|
for (const witness_id_type& witness_id : active_witnesses)
|
|
|
|
|
{
|
|
|
|
|
const witness_object& witness = witness_id(db);
|
|
|
|
|
const account_object& witness_account = witness.witness_account(db);
|
|
|
|
|
|
|
|
|
|
proposal_update_operation pup;
|
|
|
|
|
pup.proposal = proposal_id;
|
|
|
|
|
pup.fee_paying_account = witness_account.id;
|
|
|
|
|
pup.active_approvals_to_add.insert(witness_account.id);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back( pup );
|
|
|
|
|
set_expiration( db, tx );
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
db.push_transaction(tx, ~0);
|
|
|
|
|
const auto& proposal_idx = db.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
if (proposal_idx.find(proposal_id) == proposal_idx.end())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::process_operation_by_committee(operation op)
|
|
|
|
|
{
|
|
|
|
|
const vector<committee_member_id_type>& active_committee_members = db.get_global_properties().active_committee_members;
|
|
|
|
|
|
|
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = (*active_committee_members.begin())(db).committee_member_account;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(op);
|
|
|
|
|
proposal_op.expiration_time = db.head_block_time() + fc::days(1);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back(proposal_op);
|
|
|
|
|
set_expiration(db, tx);
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
processed_transaction processed_tx = db.push_transaction(tx);
|
|
|
|
|
proposal_id_type proposal_id = processed_tx.operation_results[0].get<object_id_type>();
|
|
|
|
|
|
|
|
|
|
for (const committee_member_id_type& committee_member_id : active_committee_members)
|
|
|
|
|
{
|
|
|
|
|
const committee_member_object& committee_member = committee_member_id(db);
|
|
|
|
|
const account_object& committee_member_account = committee_member.committee_member_account(db);
|
|
|
|
|
|
|
|
|
|
proposal_update_operation pup;
|
|
|
|
|
pup.proposal = proposal_id;
|
|
|
|
|
pup.fee_paying_account = committee_member_account.id;
|
|
|
|
|
pup.active_approvals_to_add.insert(committee_member_account.id);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back( pup );
|
|
|
|
|
set_expiration( db, tx );
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
db.push_transaction(tx, ~0);
|
|
|
|
|
const auto& proposal_idx = db.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
if (proposal_idx.find(proposal_id) == proposal_idx.end())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::force_operation_by_witnesses(operation op)
|
|
|
|
|
{
|
|
|
|
|
const chain_parameters& params = db.get_global_properties().parameters;
|
|
|
|
|
signed_transaction trx;
|
|
|
|
|
trx.operations = {op};
|
|
|
|
|
for( auto& op : trx.operations )
|
|
|
|
|
db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
trx.set_expiration(db.head_block_time() + fc::seconds( params.block_interval * (params.maintenance_skip_slots + 1) * 3));
|
|
|
|
|
sign(trx, init_account_priv_key);
|
|
|
|
|
PUSH_TX(db, trx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::set_is_proposed_trx(operation op)
|
|
|
|
|
{
|
|
|
|
|
const flat_set<witness_id_type>& active_witnesses = db.get_global_properties().active_witnesses;
|
|
|
|
|
|
|
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = (*active_witnesses.begin())(db).witness_account;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(op);
|
|
|
|
|
proposal_op.expiration_time = db.head_block_time() + fc::days(1);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back(proposal_op);
|
|
|
|
|
set_expiration(db, tx);
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
processed_transaction processed_tx = db.push_transaction(tx);
|
|
|
|
|
proposal_id_type proposal_id = processed_tx.operation_results[0].get<object_id_type>();
|
|
|
|
|
|
|
|
|
|
for (const witness_id_type& witness_id : active_witnesses)
|
|
|
|
|
{
|
|
|
|
|
const witness_object& witness = witness_id(db);
|
|
|
|
|
const account_object& witness_account = witness.witness_account(db);
|
|
|
|
|
|
|
|
|
|
proposal_update_operation pup;
|
|
|
|
|
pup.proposal = proposal_id;
|
|
|
|
|
pup.fee_paying_account = witness_account.id;
|
|
|
|
|
pup.active_approvals_to_add.insert(witness_account.id);
|
|
|
|
|
|
|
|
|
|
db.push_proposal(pup.proposal(db));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proposal_id_type database_fixture::propose_operation(operation op)
|
|
|
|
|
{
|
|
|
|
|
const flat_set<witness_id_type>& active_witnesses = db.get_global_properties().active_witnesses;
|
|
|
|
|
|
|
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = (*active_witnesses.begin())(db).witness_account;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(op);
|
|
|
|
|
proposal_op.expiration_time = db.head_block_time() + fc::days(1);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back(proposal_op);
|
|
|
|
|
set_expiration(db, tx);
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
processed_transaction processed_tx = db.push_transaction(tx);
|
|
|
|
|
proposal_id_type proposal_id = processed_tx.operation_results[0].get<object_id_type>();
|
|
|
|
|
|
|
|
|
|
return proposal_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::process_proposal_by_witnesses(const std::vector<witness_id_type>& witnesses, proposal_id_type proposal_id, bool remove)
|
|
|
|
|
{
|
|
|
|
|
const auto& proposal_idx = db.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
|
|
|
|
|
for (const witness_id_type& witness_id : witnesses)
|
|
|
|
|
{
|
|
|
|
|
if (proposal_idx.find(proposal_id) == proposal_idx.end())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const witness_object& witness = witness_id(db);
|
|
|
|
|
const account_object& witness_account = witness.witness_account(db);
|
|
|
|
|
|
|
|
|
|
proposal_update_operation pup;
|
|
|
|
|
pup.proposal = proposal_id;
|
|
|
|
|
pup.fee_paying_account = witness_account.id;
|
|
|
|
|
if (remove)
|
|
|
|
|
pup.active_approvals_to_remove.insert(witness_account.id);
|
|
|
|
|
else
|
|
|
|
|
pup.active_approvals_to_add.insert(witness_account.id);
|
|
|
|
|
|
|
|
|
|
signed_transaction tx;
|
|
|
|
|
tx.operations.push_back( pup );
|
|
|
|
|
set_expiration( db, tx );
|
|
|
|
|
sign(tx, init_account_priv_key);
|
|
|
|
|
|
|
|
|
|
db.push_transaction(tx, ~0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const sport_object& database_fixture::create_sport(internationalized_string_type name)
|
|
|
|
|
{ try {
|
|
|
|
|
sport_create_operation sport_create_op;
|
|
|
|
|
sport_create_op.name = name;
|
|
|
|
|
process_operation_by_witnesses(sport_create_op);
|
|
|
|
|
const auto& sport_index = db.get_index_type<sport_object_index>().indices().get<by_id>();
|
|
|
|
|
return *sport_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_sport(sport_id_type sport_id, internationalized_string_type name)
|
|
|
|
|
{ try {
|
|
|
|
|
sport_update_operation sport_update_op;
|
|
|
|
|
sport_update_op.sport_id = sport_id;
|
|
|
|
|
sport_update_op.new_name = name;
|
|
|
|
|
process_operation_by_witnesses(sport_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (sport_id)(name) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::delete_sport(sport_id_type sport_id)
|
|
|
|
|
{ try {
|
|
|
|
|
sport_delete_operation sport_delete_op;
|
|
|
|
|
sport_delete_op.sport_id = sport_id;
|
|
|
|
|
process_operation_by_witnesses(sport_delete_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (sport_id) ) }
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
const event_group_object& database_fixture::create_event_group(internationalized_string_type name, sport_id_type sport_id)
|
|
|
|
|
{ try {
|
|
|
|
|
event_group_create_operation event_group_create_op;
|
|
|
|
|
event_group_create_op.name = name;
|
|
|
|
|
event_group_create_op.sport_id = sport_id;
|
|
|
|
|
process_operation_by_witnesses(event_group_create_op);
|
|
|
|
|
const auto& event_group_index = db.get_index_type<event_group_object_index>().indices().get<by_id>();
|
|
|
|
|
return *event_group_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_event_group(event_group_id_type event_group_id,
|
|
|
|
|
fc::optional<object_id_type> sport_id,
|
|
|
|
|
fc::optional<internationalized_string_type> name)
|
|
|
|
|
{ try {
|
|
|
|
|
event_group_update_operation event_group_update_op;
|
|
|
|
|
event_group_update_op.new_name = name;
|
|
|
|
|
event_group_update_op.new_sport_id = sport_id;
|
|
|
|
|
event_group_update_op.event_group_id = event_group_id;
|
|
|
|
|
process_operation_by_witnesses(event_group_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name) )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void database_fixture::delete_event_group(event_group_id_type event_group_id)
|
|
|
|
|
{ try {
|
|
|
|
|
event_group_delete_operation event_group_delete_op;
|
|
|
|
|
event_group_delete_op.event_group_id = event_group_id;
|
|
|
|
|
process_operation_by_witnesses(event_group_delete_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (event_group_id) )
|
|
|
|
|
}
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
void database_fixture::try_update_event_group(event_group_id_type event_group_id,
|
|
|
|
|
fc::optional<object_id_type> sport_id,
|
|
|
|
|
fc::optional<internationalized_string_type> name,
|
|
|
|
|
bool dont_set_is_proposed_trx /* = false */)
|
|
|
|
|
{
|
|
|
|
|
event_group_update_operation event_group_update_op;
|
|
|
|
|
event_group_update_op.new_name = name;
|
|
|
|
|
event_group_update_op.new_sport_id = sport_id;
|
|
|
|
|
event_group_update_op.event_group_id = event_group_id;
|
|
|
|
|
|
|
|
|
|
if (!dont_set_is_proposed_trx)
|
|
|
|
|
set_is_proposed_trx(event_group_update_op);
|
|
|
|
|
|
|
|
|
|
const chain_parameters& params = db.get_global_properties().parameters;
|
|
|
|
|
signed_transaction trx;
|
|
|
|
|
trx.operations = {event_group_update_op};
|
|
|
|
|
for( auto& op : trx.operations )
|
|
|
|
|
db.current_fee_schedule().set_fee(op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
trx.set_expiration(db.head_block_time() + fc::seconds( params.block_interval * (params.maintenance_skip_slots + 1) * 3));
|
|
|
|
|
sign(trx, init_account_priv_key);
|
|
|
|
|
PUSH_TX(db, trx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const event_object& database_fixture::create_event(internationalized_string_type name, internationalized_string_type season, event_group_id_type event_group_id)
|
|
|
|
|
{ try {
|
|
|
|
|
event_create_operation event_create_op;
|
|
|
|
|
event_create_op.name = name;
|
|
|
|
|
event_create_op.season = season;
|
|
|
|
|
event_create_op.event_group_id = event_group_id;
|
|
|
|
|
process_operation_by_witnesses(event_create_op);
|
|
|
|
|
const auto& event_index = db.get_index_type<event_object_index>().indices().get<by_id>();
|
|
|
|
|
return *event_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (event_group_id) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_event_impl(event_id_type event_id,
|
|
|
|
|
fc::optional<object_id_type> event_group_id,
|
|
|
|
|
fc::optional<internationalized_string_type> name,
|
|
|
|
|
fc::optional<internationalized_string_type> season,
|
2020-02-04 18:31:45 +00:00
|
|
|
fc::optional<event_status> status,
|
2019-07-30 15:43:31 +00:00
|
|
|
bool force)
|
|
|
|
|
{ try {
|
|
|
|
|
event_update_operation event_update_op;
|
|
|
|
|
event_update_op.event_id = event_id;
|
|
|
|
|
event_update_op.new_event_group_id = event_group_id;
|
|
|
|
|
event_update_op.new_name = name;
|
|
|
|
|
event_update_op.new_season = season;
|
|
|
|
|
event_update_op.new_status = status;
|
|
|
|
|
|
|
|
|
|
if (force)
|
|
|
|
|
force_operation_by_witnesses(event_update_op);
|
|
|
|
|
else
|
|
|
|
|
process_operation_by_witnesses(event_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (event_id) ) }
|
|
|
|
|
|
|
|
|
|
const betting_market_rules_object& database_fixture::create_betting_market_rules(internationalized_string_type name, internationalized_string_type description)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_rules_create_operation betting_market_rules_create_op;
|
|
|
|
|
betting_market_rules_create_op.name = name;
|
|
|
|
|
betting_market_rules_create_op.description = description;
|
|
|
|
|
process_operation_by_witnesses(betting_market_rules_create_op);
|
|
|
|
|
const auto& betting_market_rules_index = db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>();
|
|
|
|
|
return *betting_market_rules_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_betting_market_rules(betting_market_rules_id_type rules_id,
|
|
|
|
|
fc::optional<internationalized_string_type> name,
|
|
|
|
|
fc::optional<internationalized_string_type> description)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_rules_update_operation betting_market_rules_update_op;
|
|
|
|
|
betting_market_rules_update_op.betting_market_rules_id = rules_id;
|
|
|
|
|
betting_market_rules_update_op.new_name = name;
|
|
|
|
|
betting_market_rules_update_op.new_description = description;
|
|
|
|
|
process_operation_by_witnesses(betting_market_rules_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (name)(description) ) }
|
|
|
|
|
|
2020-02-04 18:31:45 +00:00
|
|
|
const betting_market_group_object& database_fixture::create_betting_market_group(internationalized_string_type description,
|
|
|
|
|
event_id_type event_id,
|
|
|
|
|
betting_market_rules_id_type rules_id,
|
2019-07-30 15:43:31 +00:00
|
|
|
asset_id_type asset_id,
|
|
|
|
|
bool never_in_play,
|
|
|
|
|
uint32_t delay_before_settling)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_group_create_operation betting_market_group_create_op;
|
|
|
|
|
betting_market_group_create_op.description = description;
|
|
|
|
|
betting_market_group_create_op.event_id = event_id;
|
|
|
|
|
betting_market_group_create_op.rules_id = rules_id;
|
|
|
|
|
betting_market_group_create_op.asset_id = asset_id;
|
|
|
|
|
betting_market_group_create_op.never_in_play = never_in_play;
|
|
|
|
|
betting_market_group_create_op.delay_before_settling = delay_before_settling;
|
|
|
|
|
|
|
|
|
|
process_operation_by_witnesses(betting_market_group_create_op);
|
|
|
|
|
const auto& betting_market_group_index = db.get_index_type<betting_market_group_object_index>().indices().get<by_id>();
|
|
|
|
|
return *betting_market_group_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (event_id) ) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_betting_market_group_impl(betting_market_group_id_type betting_market_group_id,
|
|
|
|
|
fc::optional<internationalized_string_type> description,
|
|
|
|
|
fc::optional<object_id_type> rules_id,
|
|
|
|
|
fc::optional<betting_market_group_status> status,
|
|
|
|
|
bool force)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_group_update_operation betting_market_group_update_op;
|
|
|
|
|
betting_market_group_update_op.betting_market_group_id = betting_market_group_id;
|
|
|
|
|
betting_market_group_update_op.new_description = description;
|
|
|
|
|
betting_market_group_update_op.new_rules_id = rules_id;
|
|
|
|
|
betting_market_group_update_op.status = status;
|
|
|
|
|
|
|
|
|
|
if (force)
|
|
|
|
|
force_operation_by_witnesses(betting_market_group_update_op);
|
|
|
|
|
else
|
|
|
|
|
process_operation_by_witnesses(betting_market_group_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (betting_market_group_id)(description)(rules_id)(status)) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const betting_market_object& database_fixture::create_betting_market(betting_market_group_id_type group_id, internationalized_string_type payout_condition)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_create_operation betting_market_create_op;
|
|
|
|
|
betting_market_create_op.group_id = group_id;
|
|
|
|
|
betting_market_create_op.payout_condition = payout_condition;
|
|
|
|
|
process_operation_by_witnesses(betting_market_create_op);
|
|
|
|
|
const auto& betting_market_index = db.get_index_type<betting_market_object_index>().indices().get<by_id>();
|
|
|
|
|
return *betting_market_index.rbegin();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (payout_condition) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::update_betting_market(betting_market_id_type betting_market_id,
|
|
|
|
|
fc::optional<object_id_type> group_id,
|
|
|
|
|
/*fc::optional<internationalized_string_type> description,*/
|
|
|
|
|
fc::optional<internationalized_string_type> payout_condition)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_update_operation betting_market_update_op;
|
|
|
|
|
betting_market_update_op.betting_market_id = betting_market_id;
|
|
|
|
|
betting_market_update_op.new_group_id = group_id;
|
|
|
|
|
//betting_market_update_op.new_description = description;
|
|
|
|
|
betting_market_update_op.new_payout_condition = payout_condition;
|
|
|
|
|
process_operation_by_witnesses(betting_market_update_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (betting_market_id) (group_id) (payout_condition) ) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bet_id_type database_fixture::place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier)
|
|
|
|
|
{ try {
|
|
|
|
|
bet_place_operation bet_place_op;
|
|
|
|
|
bet_place_op.bettor_id = bettor_id;
|
|
|
|
|
bet_place_op.betting_market_id = betting_market_id;
|
|
|
|
|
bet_place_op.amount_to_bet = amount_to_bet;
|
|
|
|
|
bet_place_op.backer_multiplier = backer_multiplier;
|
|
|
|
|
bet_place_op.back_or_lay = back_or_lay;
|
2020-02-04 18:31:45 +00:00
|
|
|
|
2019-07-30 15:43:31 +00:00
|
|
|
trx.operations.push_back(bet_place_op);
|
|
|
|
|
trx.validate();
|
|
|
|
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
|
|
|
|
trx.operations.clear();
|
|
|
|
|
BOOST_CHECK_MESSAGE(ptx.operation_results.size() == 1, "Place Bet Transaction should have had exactly one operation result");
|
|
|
|
|
return ptx.operation_results.front().get<object_id_type>().as<bet_id_type>();
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (bettor_id)(back_or_lay)(amount_to_bet) ) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void database_fixture::resolve_betting_market_group(betting_market_group_id_type betting_market_group_id,
|
|
|
|
|
std::map<betting_market_id_type, betting_market_resolution_type> resolutions)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_group_resolve_operation betting_market_group_resolve_op;
|
|
|
|
|
betting_market_group_resolve_op.betting_market_group_id = betting_market_group_id;
|
|
|
|
|
betting_market_group_resolve_op.resolutions = resolutions;
|
|
|
|
|
process_operation_by_witnesses(betting_market_group_resolve_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (betting_market_group_id)(resolutions) ) }
|
|
|
|
|
|
|
|
|
|
void database_fixture::cancel_unmatched_bets(betting_market_group_id_type betting_market_group_id)
|
|
|
|
|
{ try {
|
|
|
|
|
betting_market_group_cancel_unmatched_bets_operation betting_market_group_cancel_unmatched_bets_op;
|
|
|
|
|
betting_market_group_cancel_unmatched_bets_op.betting_market_group_id = betting_market_group_id;
|
|
|
|
|
process_operation_by_witnesses(betting_market_group_cancel_unmatched_bets_op);
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW( (betting_market_group_id) ) }
|
|
|
|
|
|
|
|
|
|
|
2017-05-25 09:13:59 +00:00
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
void set_expiration( const database& db, transaction& tx )
|
|
|
|
|
{
|
|
|
|
|
const chain_parameters& params = db.get_global_properties().parameters;
|
|
|
|
|
tx.set_reference_block(db.head_block_id());
|
|
|
|
|
tx.set_expiration( db.head_block_time() + fc::seconds( params.block_interval * (params.maintenance_skip_slots + 1) * 3 ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool _push_block( database& db, const signed_block& b, uint32_t skip_flags /* = 0 */ )
|
|
|
|
|
{
|
|
|
|
|
return db.push_block( b, skip_flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processed_transaction _push_transaction( database& db, const signed_transaction& tx, uint32_t skip_flags /* = 0 */ )
|
|
|
|
|
{ try {
|
2018-08-27 19:33:58 +00:00
|
|
|
auto pt = db.push_transaction( tx, skip_flags );
|
2017-05-25 09:13:59 +00:00
|
|
|
database_fixture::verify_asset_supplies(db);
|
|
|
|
|
return pt;
|
|
|
|
|
} FC_CAPTURE_AND_RETHROW((tx)) }
|
|
|
|
|
|
|
|
|
|
} // graphene::chain::test
|
|
|
|
|
|
|
|
|
|
} } // graphene::chain
|