Merge branch 'beatrice' into develop
This commit is contained in:
commit
76d14a5d11
24 changed files with 170 additions and 130 deletions
|
|
@ -88,14 +88,14 @@ then proceed with:
|
||||||
cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release .
|
cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release .
|
||||||
make
|
make
|
||||||
./programs/witness_node/witness_node
|
./programs/witness_node/witness_node
|
||||||
|
|
||||||
Launching the witness creates required directories. Next, **stop the witness** and continue.
|
Launching the witness creates required directories. Next, **stop the witness** and continue.
|
||||||
|
|
||||||
$ vi witness_node_data_dir/config.ini
|
$ vi witness_node_data_dir/config.ini
|
||||||
p2p-endpoint = 0.0.0.0:9777
|
p2p-endpoint = 0.0.0.0:9777
|
||||||
rpc-endpoint = 127.0.0.1:8090
|
rpc-endpoint = 127.0.0.1:8090
|
||||||
seed-node = 213.184.225.234:59500
|
seed-node = 213.184.225.234:59500
|
||||||
|
|
||||||
Start the witness back up
|
Start the witness back up
|
||||||
|
|
||||||
./programs/witness_node/witness_node
|
./programs/witness_node/witness_node
|
||||||
|
|
@ -155,7 +155,7 @@ Create your witness (substitute the url for your witness information)
|
||||||
```
|
```
|
||||||
create_witness your_witness_username "url" true
|
create_witness your_witness_username "url" true
|
||||||
```
|
```
|
||||||
**Be sure to take note of the block_signing_key**
|
**Be sure to take note of the block_signing_key**
|
||||||
|
|
||||||
IMPORTANT (issue below command using block_signing_key just obtained)
|
IMPORTANT (issue below command using block_signing_key just obtained)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
2
docs
2
docs
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8d8b69d82482101279460fa02f814d0e4030966f
|
Subproject commit 8df8f66389853df73ab8f6dd73981be2a6957df8
|
||||||
|
|
@ -181,7 +181,7 @@ namespace graphene { namespace app {
|
||||||
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
|
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
|
||||||
{
|
{
|
||||||
trx.validate();
|
trx.validate();
|
||||||
_app.chain_database()->check_tansaction_for_duplicated_operations(trx);
|
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
|
||||||
_app.chain_database()->push_transaction(trx);
|
_app.chain_database()->push_transaction(trx);
|
||||||
if( _app.p2p_node() != nullptr )
|
if( _app.p2p_node() != nullptr )
|
||||||
_app.p2p_node()->broadcast_transaction(trx);
|
_app.p2p_node()->broadcast_transaction(trx);
|
||||||
|
|
@ -189,8 +189,8 @@ namespace graphene { namespace app {
|
||||||
|
|
||||||
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx)
|
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx)
|
||||||
{
|
{
|
||||||
_app.chain_database()->check_tansaction_for_duplicated_operations(trx);
|
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
|
||||||
|
|
||||||
fc::promise<fc::variant>::ptr prom( new fc::promise<fc::variant>() );
|
fc::promise<fc::variant>::ptr prom( new fc::promise<fc::variant>() );
|
||||||
broadcast_transaction_with_callback( [=]( const fc::variant& v ){
|
broadcast_transaction_with_callback( [=]( const fc::variant& v ){
|
||||||
prom->set_value(v);
|
prom->set_value(v);
|
||||||
|
|
|
||||||
|
|
@ -160,10 +160,12 @@ namespace detail {
|
||||||
{
|
{
|
||||||
// t.me/peerplays #seednodes
|
// t.me/peerplays #seednodes
|
||||||
vector<string> seeds = {
|
vector<string> seeds = {
|
||||||
"ppy-beatrice-seed.blckchnd.com:6666",
|
"pts.blockveritas.co:6666",
|
||||||
"159.69.223.206:7777",
|
"seed-beatrice01.eifos.org:7777",
|
||||||
"51.38.237.243:9666",
|
"seed-testnet.ppy.alex-pu.info:7777",
|
||||||
"pbsa-beatrice.blockchainprojectsbv.com:9195"
|
"seed.ppy-beatrice.blckchnd.com:6666",
|
||||||
|
"seed.testnet.peerblock.trade:6666",
|
||||||
|
"testnet-ppyapi.spacemx.tech:9777"
|
||||||
};
|
};
|
||||||
|
|
||||||
for( const string& endpoint_string : seeds )
|
for( const string& endpoint_string : seeds )
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
vector<vector<account_id_type>> get_key_references( vector<public_key_type> key )const;
|
vector<vector<account_id_type>> get_key_references( vector<public_key_type> key )const;
|
||||||
bool is_public_key_registered(string public_key) const;
|
bool is_public_key_registered(string public_key) const;
|
||||||
|
|
||||||
// Accounts
|
// Accounts
|
||||||
account_id_type get_account_id_from_string(const std::string& name_or_id)const;
|
account_id_type get_account_id_from_string(const std::string& name_or_id)const;
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
||||||
{
|
{
|
||||||
auto dotpos = op.symbol.rfind( '.' );
|
auto dotpos = op.symbol.rfind( '.' );
|
||||||
if( dotpos != std::string::npos )
|
if( dotpos != std::string::npos )
|
||||||
|
|
||||||
{
|
{
|
||||||
auto prefix = op.symbol.substr( 0, dotpos );
|
auto prefix = op.symbol.substr( 0, dotpos );
|
||||||
auto asset_symbol_itr = asset_indx.find( prefix );
|
auto asset_symbol_itr = asset_indx.find( prefix );
|
||||||
|
|
@ -122,7 +122,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
||||||
FC_ASSERT( op.bitasset_opts );
|
FC_ASSERT( op.bitasset_opts );
|
||||||
FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision );
|
FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision );
|
||||||
}
|
}
|
||||||
|
|
||||||
return void_result();
|
return void_result();
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ object_id_type asset_create_evaluator::do_apply( const asset_create_operation& o
|
||||||
a.options.core_exchange_rate.base.asset_id = next_asset_id;
|
a.options.core_exchange_rate.base.asset_id = next_asset_id;
|
||||||
|
|
||||||
a.dynamic_asset_data_id = dyn_asset.id;
|
a.dynamic_asset_data_id = dyn_asset.id;
|
||||||
|
|
||||||
if( op.bitasset_opts.valid() )
|
if( op.bitasset_opts.valid() )
|
||||||
a.bitasset_data_id = bit_asset_id;
|
a.bitasset_data_id = bit_asset_id;
|
||||||
});
|
});
|
||||||
|
|
@ -225,7 +225,7 @@ void_result lottery_asset_create_evaluator::do_evaluate( const lottery_asset_cre
|
||||||
{
|
{
|
||||||
auto dotpos = op.symbol.rfind( '.' );
|
auto dotpos = op.symbol.rfind( '.' );
|
||||||
if( dotpos != std::string::npos )
|
if( dotpos != std::string::npos )
|
||||||
|
|
||||||
{
|
{
|
||||||
auto prefix = op.symbol.substr( 0, dotpos );
|
auto prefix = op.symbol.substr( 0, dotpos );
|
||||||
auto asset_symbol_itr = asset_indx.find( prefix );
|
auto asset_symbol_itr = asset_indx.find( prefix );
|
||||||
|
|
@ -578,7 +578,7 @@ void_result asset_update_dividend_evaluator::do_evaluate(const asset_update_divi
|
||||||
auto& params = db().get_global_properties().parameters;
|
auto& params = db().get_global_properties().parameters;
|
||||||
if (o.new_options.payout_interval &&
|
if (o.new_options.payout_interval &&
|
||||||
*o.new_options.payout_interval < params.maintenance_interval)
|
*o.new_options.payout_interval < params.maintenance_interval)
|
||||||
FC_THROW("New payout interval may not be less than the maintenance interval",
|
FC_THROW("New payout interval may not be less than the maintenance interval",
|
||||||
("new_payout_interval", o.new_options.payout_interval)("maintenance_interval", params.maintenance_interval));
|
("new_payout_interval", o.new_options.payout_interval)("maintenance_interval", params.maintenance_interval));
|
||||||
return void_result();
|
return void_result();
|
||||||
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
} FC_CAPTURE_AND_RETHROW( (o) ) }
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct proposed_operations_digest_accumulator
|
struct proposed_operations_digest_accumulator
|
||||||
{
|
{
|
||||||
typedef void result_type;
|
typedef void result_type;
|
||||||
|
|
||||||
void operator()(const graphene::chain::proposal_create_operation& proposal)
|
void operator()(const graphene::chain::proposal_create_operation& proposal)
|
||||||
{
|
{
|
||||||
for (auto& operation: proposal.proposed_ops)
|
for (auto& operation: proposal.proposed_ops)
|
||||||
|
|
@ -56,20 +56,20 @@ namespace {
|
||||||
proposed_operations_digests.push_back(fc::digest(operation.op));
|
proposed_operations_digests.push_back(fc::digest(operation.op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//empty template method is needed for all other operation types
|
//empty template method is needed for all other operation types
|
||||||
//we can ignore them, we are interested in only proposal_create_operation
|
//we can ignore them, we are interested in only proposal_create_operation
|
||||||
template<class T>
|
template<class T>
|
||||||
void operator()(const T&)
|
void operator()(const T&)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::vector<fc::sha256> proposed_operations_digests;
|
std::vector<fc::sha256> proposed_operations_digests;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<fc::sha256> gather_proposed_operations_digests(const graphene::chain::transaction& trx)
|
std::vector<fc::sha256> gather_proposed_operations_digests(const graphene::chain::transaction& trx)
|
||||||
{
|
{
|
||||||
proposed_operations_digest_accumulator digest_accumulator;
|
proposed_operations_digest_accumulator digest_accumulator;
|
||||||
|
|
||||||
for (auto& operation: trx.operations)
|
for (auto& operation: trx.operations)
|
||||||
{
|
{
|
||||||
if( operation.which() != graphene::chain::operation::tag<graphene::chain::betting_market_group_create_operation>::value
|
if( operation.which() != graphene::chain::operation::tag<graphene::chain::betting_market_group_create_operation>::value
|
||||||
|
|
@ -78,7 +78,7 @@ namespace {
|
||||||
else
|
else
|
||||||
edump( ("Found dup"));
|
edump( ("Found dup"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return digest_accumulator.proposed_operations_digests;
|
return digest_accumulator.proposed_operations_digests;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -148,24 +148,24 @@ std::vector<block_id_type> database::get_block_ids_on_fork(block_id_type head_of
|
||||||
result.emplace_back(branches.first.back()->previous_id());
|
result.emplace_back(branches.first.back()->previous_id());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void database::check_tansaction_for_duplicated_operations(const signed_transaction& trx)
|
void database::check_transaction_for_duplicated_operations(const signed_transaction& trx)
|
||||||
{
|
{
|
||||||
const auto& proposal_index = get_index<proposal_object>();
|
const auto& proposal_index = get_index<proposal_object>();
|
||||||
std::set<fc::sha256> existed_operations_digests;
|
std::set<fc::sha256> existed_operations_digests;
|
||||||
|
|
||||||
proposal_index.inspect_all_objects( [&](const object& obj){
|
proposal_index.inspect_all_objects( [&](const object& obj){
|
||||||
const proposal_object& proposal = static_cast<const proposal_object&>(obj);
|
const proposal_object& proposal = static_cast<const proposal_object&>(obj);
|
||||||
auto proposed_operations_digests = gather_proposed_operations_digests( proposal.proposed_transaction );
|
auto proposed_operations_digests = gather_proposed_operations_digests( proposal.proposed_transaction );
|
||||||
existed_operations_digests.insert( proposed_operations_digests.begin(), proposed_operations_digests.end() );
|
existed_operations_digests.insert( proposed_operations_digests.begin(), proposed_operations_digests.end() );
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto& pending_transaction: _pending_tx)
|
for (auto& pending_transaction: _pending_tx)
|
||||||
{
|
{
|
||||||
auto proposed_operations_digests = gather_proposed_operations_digests(pending_transaction);
|
auto proposed_operations_digests = gather_proposed_operations_digests(pending_transaction);
|
||||||
existed_operations_digests.insert(proposed_operations_digests.begin(), proposed_operations_digests.end());
|
existed_operations_digests.insert(proposed_operations_digests.begin(), proposed_operations_digests.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto proposed_operations_digests = gather_proposed_operations_digests(trx);
|
auto proposed_operations_digests = gather_proposed_operations_digests(trx);
|
||||||
for (auto& digest: proposed_operations_digests)
|
for (auto& digest: proposed_operations_digests)
|
||||||
{
|
{
|
||||||
|
|
@ -337,7 +337,7 @@ void database::verify_signing_witness( const signed_block& new_block, const fork
|
||||||
FC_ASSERT( new_block.witness == wid, "Witness produced block at wrong time",
|
FC_ASSERT( new_block.witness == wid, "Witness produced block at wrong time",
|
||||||
("block witness",new_block.witness)("scheduled",wid)("slot_num",slot_num) );
|
("block witness",new_block.witness)("scheduled",wid)("slot_num",slot_num) );
|
||||||
FC_ASSERT( new_block.validate_signee( wid(*this).signing_key ) );
|
FC_ASSERT( new_block.validate_signee( wid(*this).signing_key ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void database::update_witnesses( fork_item& fork_entry )const
|
void database::update_witnesses( fork_item& fork_entry )const
|
||||||
|
|
@ -351,7 +351,7 @@ void database::update_witnesses( fork_item& fork_entry )const
|
||||||
const witness_schedule_object& wso = get_witness_schedule_object();
|
const witness_schedule_object& wso = get_witness_schedule_object();
|
||||||
fork_entry.scheduled_witnesses = std::make_shared< vector< pair< witness_id_type, public_key_type > > >();
|
fork_entry.scheduled_witnesses = std::make_shared< vector< pair< witness_id_type, public_key_type > > >();
|
||||||
fork_entry.scheduled_witnesses->reserve( wso.current_shuffled_witnesses.size() );
|
fork_entry.scheduled_witnesses->reserve( wso.current_shuffled_witnesses.size() );
|
||||||
|
|
||||||
for( size_t i = 0; i < wso.current_shuffled_witnesses.size(); ++i )
|
for( size_t i = 0; i < wso.current_shuffled_witnesses.size(); ++i )
|
||||||
{
|
{
|
||||||
const auto& witness = wso.current_shuffled_witnesses[i](*this);
|
const auto& witness = wso.current_shuffled_witnesses[i](*this);
|
||||||
|
|
@ -551,7 +551,7 @@ signed_block database::_generate_block(
|
||||||
pending_block.timestamp = when;
|
pending_block.timestamp = when;
|
||||||
pending_block.transaction_merkle_root = pending_block.calculate_merkle_root();
|
pending_block.transaction_merkle_root = pending_block.calculate_merkle_root();
|
||||||
pending_block.witness = witness_id;
|
pending_block.witness = witness_id;
|
||||||
|
|
||||||
// Genesis witnesses start with a default initial secret
|
// Genesis witnesses start with a default initial secret
|
||||||
if( witness_obj.next_secret_hash == secret_hash_type::hash( secret_hash_type() ) ) {
|
if( witness_obj.next_secret_hash == secret_hash_type::hash( secret_hash_type() ) ) {
|
||||||
pending_block.previous_secret = secret_hash_type();
|
pending_block.previous_secret = secret_hash_type();
|
||||||
|
|
@ -561,7 +561,7 @@ signed_block database::_generate_block(
|
||||||
fc::raw::pack( last_enc, witness_obj.previous_secret );
|
fc::raw::pack( last_enc, witness_obj.previous_secret );
|
||||||
pending_block.previous_secret = last_enc.result();
|
pending_block.previous_secret = last_enc.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
secret_hash_type::encoder next_enc;
|
secret_hash_type::encoder next_enc;
|
||||||
fc::raw::pack( next_enc, block_signing_private_key );
|
fc::raw::pack( next_enc, block_signing_private_key );
|
||||||
fc::raw::pack( next_enc, pending_block.previous_secret );
|
fc::raw::pack( next_enc, pending_block.previous_secret );
|
||||||
|
|
@ -692,10 +692,10 @@ void database::_apply_block( const signed_block& next_block )
|
||||||
// For VOPs derived directly from a real op,
|
// For VOPs derived directly from a real op,
|
||||||
// use the real op's (block_num,trx_in_block,op_in_trx), virtual_op starts from 1.
|
// use the real op's (block_num,trx_in_block,op_in_trx), virtual_op starts from 1.
|
||||||
// For VOPs created after processed all transactions,
|
// For VOPs created after processed all transactions,
|
||||||
// trx_in_block = the_block.trsanctions.size(), virtual_op starts from 0.
|
// trx_in_block = the_block.trsanctions.size(), virtual_op starts from 0.
|
||||||
++_current_trx_in_block;
|
++_current_trx_in_block;
|
||||||
_current_op_in_trx = 0;
|
_current_op_in_trx = 0;
|
||||||
_current_virtual_op = 0;
|
_current_virtual_op = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM) {
|
if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM) {
|
||||||
|
|
@ -713,9 +713,9 @@ void database::_apply_block( const signed_block& next_block )
|
||||||
// Are we at the maintenance interval?
|
// Are we at the maintenance interval?
|
||||||
if( maint_needed )
|
if( maint_needed )
|
||||||
perform_chain_maintenance(next_block, global_props);
|
perform_chain_maintenance(next_block, global_props);
|
||||||
|
|
||||||
check_ending_lotteries();
|
check_ending_lotteries();
|
||||||
|
|
||||||
create_block_summary(next_block);
|
create_block_summary(next_block);
|
||||||
place_delayed_bets(); // must happen after update_global_dynamic_data() updates the time
|
place_delayed_bets(); // must happen after update_global_dynamic_data() updates the time
|
||||||
clear_expired_transactions();
|
clear_expired_transactions();
|
||||||
|
|
@ -786,7 +786,7 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
|
||||||
auto& trx_idx = get_mutable_index_type<transaction_index>();
|
auto& trx_idx = get_mutable_index_type<transaction_index>();
|
||||||
const chain_id_type& chain_id = get_chain_id();
|
const chain_id_type& chain_id = get_chain_id();
|
||||||
transaction_id_type trx_id;
|
transaction_id_type trx_id;
|
||||||
|
|
||||||
if( !(skip & skip_transaction_dupe_check) )
|
if( !(skip & skip_transaction_dupe_check) )
|
||||||
{
|
{
|
||||||
trx_id = trx.id();
|
trx_id = trx.id();
|
||||||
|
|
@ -884,7 +884,7 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign
|
||||||
FC_ASSERT( secret_hash_type::hash( next_block.previous_secret ) == witness.next_secret_hash, "",
|
FC_ASSERT( secret_hash_type::hash( next_block.previous_secret ) == witness.next_secret_hash, "",
|
||||||
( "previous_secret", next_block.previous_secret )( "next_secret_hash", witness.next_secret_hash ) );
|
( "previous_secret", next_block.previous_secret )( "next_secret_hash", witness.next_secret_hash ) );
|
||||||
|
|
||||||
if( !(skip&skip_witness_signature) )
|
if( !(skip&skip_witness_signature) )
|
||||||
FC_ASSERT( next_block.validate_signee( witness.signing_key ) );
|
FC_ASSERT( next_block.validate_signee( witness.signing_key ) );
|
||||||
|
|
||||||
if( !(skip&skip_witness_schedule_check) )
|
if( !(skip&skip_witness_schedule_check) )
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// SON HARDFORK Wednesday, October 28, 2020 0:00:00 GMT
|
// SON HARDFORK Wednesday, October 28, 2020 0:00:00 GMT
|
||||||
#ifndef HARDFORK_SON_TIME
|
#ifndef HARDFORK_SON_TIME
|
||||||
#include <ctime>
|
|
||||||
#define HARDFORK_SON_TIME (fc::time_point_sec( 1603843200 ))
|
#define HARDFORK_SON_TIME (fc::time_point_sec( 1603843200 ))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ namespace graphene
|
||||||
using account_role_multi_index_type = multi_index_container<
|
using account_role_multi_index_type = multi_index_container<
|
||||||
account_role_object,
|
account_role_object,
|
||||||
indexed_by<
|
indexed_by<
|
||||||
ordered_unique< tag<by_id>,
|
ordered_unique< tag<by_id>,
|
||||||
member<object, object_id_type, &object::id>
|
member<object, object_id_type, &object::id>
|
||||||
>,
|
>,
|
||||||
ordered_non_unique< tag<by_owner>,
|
ordered_non_unique< tag<by_owner>,
|
||||||
member<account_role_object, account_id_type, &account_role_object::owner>
|
member<account_role_object, account_id_type, &account_role_object::owner>
|
||||||
>,
|
>,
|
||||||
ordered_unique< tag<by_expiration>,
|
ordered_unique< tag<by_expiration>,
|
||||||
|
|
@ -46,4 +46,4 @@ namespace graphene
|
||||||
} // namespace graphene
|
} // namespace graphene
|
||||||
|
|
||||||
FC_REFLECT_DERIVED(graphene::chain::account_role_object, (graphene::db::object),
|
FC_REFLECT_DERIVED(graphene::chain::account_role_object, (graphene::db::object),
|
||||||
(owner)(name)(metadata)(allowed_operations)(whitelisted_accounts)(valid_to))
|
(owner)(name)(metadata)(allowed_operations)(whitelisted_accounts)(valid_to))
|
||||||
|
|
|
||||||
|
|
@ -718,8 +718,8 @@ inline Stream& operator>>( Stream& s, betting_market_group_object& betting_marke
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) )
|
FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description) )
|
FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description)(event_id)(rules_id)(asset_id)(total_matched_bets_amount)(never_in_play)(delay_before_settling)(settling_time) )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id) )
|
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id)(description)(payout_condition)(resolution) )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) )
|
FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) )
|
||||||
|
|
||||||
FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) )
|
FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) )
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
#define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4
|
#define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4
|
||||||
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
|
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
|
||||||
|
|
||||||
#define GRAPHENE_CURRENT_DB_VERSION "PPY2.3"
|
#define GRAPHENE_CURRENT_DB_VERSION "PPY2.4"
|
||||||
|
|
||||||
#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT)
|
#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,8 @@ namespace graphene { namespace chain {
|
||||||
void add_checkpoints( const flat_map<uint32_t,block_id_type>& checkpts );
|
void add_checkpoints( const flat_map<uint32_t,block_id_type>& checkpts );
|
||||||
const flat_map<uint32_t,block_id_type> get_checkpoints()const { return _checkpoints; }
|
const flat_map<uint32_t,block_id_type> get_checkpoints()const { return _checkpoints; }
|
||||||
bool before_last_checkpoint()const;
|
bool before_last_checkpoint()const;
|
||||||
|
|
||||||
void check_tansaction_for_duplicated_operations(const signed_transaction& trx);
|
void check_transaction_for_duplicated_operations(const signed_transaction& trx);
|
||||||
|
|
||||||
bool push_block( const signed_block& b, uint32_t skip = skip_nothing );
|
bool push_block( const signed_block& b, uint32_t skip = skip_nothing );
|
||||||
processed_transaction push_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing );
|
processed_transaction push_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing );
|
||||||
|
|
|
||||||
|
|
@ -158,5 +158,6 @@ typedef generic_index<event_object, event_object_multi_index_type> event_object_
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
FC_REFLECT(graphene::chain::event_object, (name))
|
FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -481,13 +481,13 @@ FC_REFLECT( graphene::chain::bet_place_operation,
|
||||||
(fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) )
|
(fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) )
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, )
|
FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, )
|
||||||
FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )
|
FC_REFLECT( graphene::chain::bet_matched_operation, (fee)(bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) )
|
FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) )
|
||||||
FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) )
|
FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) )
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, )
|
FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, )
|
||||||
FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) )
|
FC_REFLECT( graphene::chain::bet_canceled_operation, (fee)(bettor_id)(bet_id)(stake_returned) )
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, )
|
FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, )
|
||||||
FC_REFLECT( graphene::chain::bet_adjusted_operation, (bettor_id)(bet_id)(stake_returned) )
|
FC_REFLECT( graphene::chain::bet_adjusted_operation, (fee) (bettor_id)(bet_id)(stake_returned) )
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,18 @@ struct proposal_operation_hardfork_visitor
|
||||||
FC_ASSERT( !aco.extensions.value.affiliate_distributions.valid(), "Affiliate reward distributions not allowed yet" );
|
FC_ASSERT( !aco.extensions.value.affiliate_distributions.valid(), "Affiliate reward distributions not allowed yet" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator()(const sport_create_operation &v) const {
|
||||||
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_create_operation not allowed yet!" );
|
||||||
|
}
|
||||||
|
|
||||||
void operator()(const sport_update_operation &v) const {
|
void operator()(const sport_update_operation &v) const {
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_update_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_update_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator()(const sport_delete_operation &v) const {
|
||||||
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_delete_operation not allowed yet!" );
|
||||||
|
}
|
||||||
|
|
||||||
void operator()(const event_group_create_operation &v) const {
|
void operator()(const event_group_create_operation &v) const {
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_create_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_create_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +82,10 @@ struct proposal_operation_hardfork_visitor
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_update_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_update_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator()(const event_group_delete_operation &v) const {
|
||||||
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_delete_operation not allowed yet!" );
|
||||||
|
}
|
||||||
|
|
||||||
void operator()(const event_create_operation &v) const {
|
void operator()(const event_create_operation &v) const {
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_create_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_create_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +123,7 @@ struct proposal_operation_hardfork_visitor
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const bet_cancel_operation &v) const {
|
void operator()(const bet_cancel_operation &v) const {
|
||||||
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "betting_market_group_resolve_operation not allowed yet!" );
|
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "bet_cancel_operation not allowed yet!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const betting_market_group_update_operation &v) const {
|
void operator()(const betting_market_group_update_operation &v) const {
|
||||||
|
|
|
||||||
|
|
@ -1838,14 +1838,17 @@ BOOST_AUTO_TEST_CASE(event_group_delete_test_with_matched_bets)
|
||||||
transfer(account_id_type(), bob_id, asset(initialAccountAsset));
|
transfer(account_id_type(), bob_id, asset(initialAccountAsset));
|
||||||
generate_blocks(1);
|
generate_blocks(1);
|
||||||
|
|
||||||
const auto& event = create_event({{"en", "event"}}, {{"en", "2016-17"}}, nhl.id);
|
create_event({{"en", "event"}}, {{"en", "2016-17"}}, nhl.id);
|
||||||
generate_blocks(1);
|
generate_blocks(1);
|
||||||
|
const event_object& event = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin();
|
||||||
|
|
||||||
const auto& market_group = create_betting_market_group({{"en", "market group"}}, event.id, betting_market_rules.id, asset_id_type(), false, 0);
|
create_betting_market_group({{"en", "market group"}}, event.id, betting_market_rules.id, asset_id_type(), false, 0);
|
||||||
generate_blocks(1);
|
generate_blocks(1);
|
||||||
|
const betting_market_group_object& market_group = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin();
|
||||||
|
|
||||||
const auto& market = create_betting_market(market_group.id, {{"en", "market"}});
|
create_betting_market(market_group.id, {{"en", "market"}});
|
||||||
generate_blocks(1);
|
generate_blocks(1);
|
||||||
|
const betting_market_object& market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin();
|
||||||
|
|
||||||
place_bet(alice_id, market.id, bet_type::back, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
place_bet(alice_id, market.id, bet_type::back, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
||||||
place_bet(bob_id, market.id, bet_type::lay, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
place_bet(bob_id, market.id, bet_type::lay, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
||||||
|
|
@ -1877,9 +1880,8 @@ BOOST_AUTO_TEST_CASE(event_group_delete_test_not_existed_event_group)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CREATE_ICE_HOCKEY_BETTING_MARKET(false, 0);
|
CREATE_ICE_HOCKEY_BETTING_MARKET(false, 0);
|
||||||
event_group_id_type nhl_id = nhl.id;
|
event_group_id_type nhl_id = nhl.id;
|
||||||
delete_event_group(nhl_id);
|
delete_event_group(nhl_id);
|
||||||
|
|
||||||
|
|
||||||
BOOST_CHECK_THROW(delete_event_group(nhl_id), fc::exception);
|
BOOST_CHECK_THROW(delete_event_group(nhl_id), fc::exception);
|
||||||
} FC_LOG_AND_RETHROW()
|
} FC_LOG_AND_RETHROW()
|
||||||
|
|
@ -3013,7 +3015,8 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||||
|
|
||||||
// betting operations don't take effect until HARDFORK 1000
|
// betting operations don't take effect until HARDFORK 1000
|
||||||
GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2;
|
GRAPHENE_TESTING_GENESIS_TIMESTAMP =
|
||||||
|
(HARDFORK_1000_TIME.sec_since_epoch() + 15) / GRAPHENE_DEFAULT_BLOCK_INTERVAL * GRAPHENE_DEFAULT_BLOCK_INTERVAL;
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,9 +201,39 @@ cli_fixture::~cli_fixture()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cli_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks, uint32_t skip)
|
||||||
|
{
|
||||||
|
auto db = app1->chain_database();
|
||||||
|
|
||||||
|
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, fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key"))), slots_to_miss);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while( db->head_block_time() < timestamp )
|
||||||
|
generate_block(skip);
|
||||||
|
}
|
||||||
|
|
||||||
|
signed_block cli_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 db = app1->chain_database();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
bool cli_fixture::generate_maintenance_block() {
|
bool cli_fixture::generate_maintenance_block() {
|
||||||
try {
|
try {
|
||||||
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
|
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
|
||||||
uint32_t skip = ~database::skip_fork_db;
|
uint32_t skip = ~database::skip_fork_db;
|
||||||
auto db = app1->chain_database();
|
auto db = app1->chain_database();
|
||||||
auto maint_time = db->get_dynamic_global_properties().next_maintenance_time;
|
auto maint_time = db->get_dynamic_global_properties().next_maintenance_time;
|
||||||
|
|
@ -219,27 +249,6 @@ bool cli_fixture::generate_maintenance_block() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cli_fixture::generate_block()
|
|
||||||
{
|
|
||||||
graphene::chain::signed_block returned_block;
|
|
||||||
return generate_block(returned_block);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cli_fixture::generate_block(graphene::chain::signed_block& returned_block)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
|
|
||||||
auto db = app1->chain_database();
|
|
||||||
returned_block = db->generate_block( db->get_slot_time(1),
|
|
||||||
db->get_scheduled_witness(1),
|
|
||||||
committee_key,
|
|
||||||
database::skip_nothing );
|
|
||||||
return true;
|
|
||||||
} catch (exception &e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cli_fixture::init_nathan()
|
void cli_fixture::init_nathan()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -254,7 +263,7 @@ void cli_fixture::init_nathan()
|
||||||
import_txs = con.wallet_api_ptr->import_balance("nathan", nathan_keys, true);
|
import_txs = con.wallet_api_ptr->import_balance("nathan", nathan_keys, true);
|
||||||
nathan_acct_before_upgrade = con.wallet_api_ptr->get_account("nathan");
|
nathan_acct_before_upgrade = con.wallet_api_ptr->get_account("nathan");
|
||||||
|
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// upgrade nathan
|
// upgrade nathan
|
||||||
BOOST_TEST_MESSAGE("Upgrading Nathan to LTM");
|
BOOST_TEST_MESSAGE("Upgrading Nathan to LTM");
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,12 @@ struct cli_fixture
|
||||||
cli_fixture();
|
cli_fixture();
|
||||||
~cli_fixture();
|
~cli_fixture();
|
||||||
|
|
||||||
///////////
|
signed_block generate_block(uint32_t skip = ~0,
|
||||||
/// Send a block to the db
|
const fc::ecc::private_key& key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key"))),
|
||||||
/// @param returned_block the signed block
|
int miss_blocks = 0);
|
||||||
/// @returns true on success
|
|
||||||
///////////
|
void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true, uint32_t skip = ~0);
|
||||||
bool generate_block(graphene::chain::signed_block& returned_block);
|
|
||||||
bool generate_block();
|
|
||||||
///////////
|
///////////
|
||||||
/// @brief Skip intermediate blocks, and generate a maintenance block
|
/// @brief Skip intermediate blocks, and generate a maintenance block
|
||||||
/// @returns true on success
|
/// @returns true on success
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( create_new_account )
|
||||||
BOOST_CHECK(con.wallet_api_ptr->import_key("jmjatlanta", bki.wif_priv_key));
|
BOOST_CHECK(con.wallet_api_ptr->import_key("jmjatlanta", bki.wif_priv_key));
|
||||||
con.wallet_api_ptr->save_wallet_file(con.wallet_filename);
|
con.wallet_api_ptr->save_wallet_file(con.wallet_filename);
|
||||||
|
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
fc::usleep( fc::seconds(1) );
|
fc::usleep( fc::seconds(1) );
|
||||||
|
|
||||||
// attempt to give jmjatlanta some peerplays
|
// attempt to give jmjatlanta some peerplays
|
||||||
|
|
@ -112,7 +112,7 @@ BOOST_FIXTURE_TEST_CASE( cli_vote_for_2_witnesses, cli_fixture )
|
||||||
signed_transaction vote_witness1_tx = con.wallet_api_ptr->vote_for_witness("jmjatlanta", "init1", true, true);
|
signed_transaction vote_witness1_tx = con.wallet_api_ptr->vote_for_witness("jmjatlanta", "init1", true, true);
|
||||||
|
|
||||||
// generate a block to get things started
|
// generate a block to get things started
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
// wait for a maintenance interval
|
// wait for a maintenance interval
|
||||||
BOOST_CHECK(generate_maintenance_block());
|
BOOST_CHECK(generate_maintenance_block());
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE( account_history_pagination )
|
||||||
"1.3.0", "Here are some CORE token for your new account", true);
|
"1.3.0", "Here are some CORE token for your new account", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// now get account history and make sure everything is there (and no duplicates)
|
// now get account history and make sure everything is there (and no duplicates)
|
||||||
std::vector<graphene::wallet::operation_detail> history = con.wallet_api_ptr->get_account_history("jmjatlanta", 300);
|
std::vector<graphene::wallet::operation_detail> history = con.wallet_api_ptr->get_account_history("jmjatlanta", 300);
|
||||||
|
|
@ -489,7 +489,7 @@ BOOST_FIXTURE_TEST_CASE( saving_keys_wallet_test, cli_fixture )
|
||||||
graphene::wallet::plain_keys pk = decrypt_keys( "supersecret", wallet.cipher_keys );
|
graphene::wallet::plain_keys pk = decrypt_keys( "supersecret", wallet.cipher_keys );
|
||||||
BOOST_CHECK( pk.keys.size() == 1 ); // nathan key
|
BOOST_CHECK( pk.keys.size() == 1 ); // nathan key
|
||||||
|
|
||||||
BOOST_CHECK( generate_block() );
|
generate_block();
|
||||||
fc::usleep( fc::seconds(1) );
|
fc::usleep( fc::seconds(1) );
|
||||||
|
|
||||||
wallet = fc::json::from_file( path ).as<graphene::wallet::wallet_data>( 2 * GRAPHENE_MAX_NESTED_OBJECTS );
|
wallet = fc::json::from_file( path ).as<graphene::wallet::wallet_data>( 2 * GRAPHENE_MAX_NESTED_OBJECTS );
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include <graphene/chain/config.hpp>
|
||||||
|
#include <graphene/chain/hardfork.hpp>
|
||||||
|
|
||||||
class son_test_helper
|
class son_test_helper
|
||||||
{
|
{
|
||||||
cli_fixture& fixture_;
|
cli_fixture& fixture_;
|
||||||
|
|
@ -36,6 +39,8 @@ public:
|
||||||
fixture_(fixture)
|
fixture_(fixture)
|
||||||
{
|
{
|
||||||
fixture_.init_nathan();
|
fixture_.init_nathan();
|
||||||
|
fixture_.generate_blocks(HARDFORK_SON_TIME);
|
||||||
|
fixture_.generate_block();
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_son(const std::string& account_name, const std::string& son_url,
|
void create_son(const std::string& account_name, const std::string& son_url,
|
||||||
|
|
@ -65,7 +70,7 @@ public:
|
||||||
"nathan", account_name, "65000", "1.3.0", "Here are some CORE token for your new account", true
|
"nathan", account_name, "65000", "1.3.0", "Here are some CORE token for your new account", true
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOST_CHECK(fixture_.generate_block());
|
fixture_.generate_block();
|
||||||
|
|
||||||
// upgrade son account
|
// upgrade son account
|
||||||
BOOST_TEST_MESSAGE("Upgrading son account to LTM");
|
BOOST_TEST_MESSAGE("Upgrading son account to LTM");
|
||||||
|
|
@ -75,16 +80,16 @@ public:
|
||||||
// verify that the upgrade was successful
|
// verify that the upgrade was successful
|
||||||
BOOST_CHECK(son_account.is_lifetime_member());
|
BOOST_CHECK(son_account.is_lifetime_member());
|
||||||
|
|
||||||
BOOST_CHECK(fixture_.generate_block());
|
fixture_.generate_block();
|
||||||
|
|
||||||
// create deposit vesting
|
// create deposit vesting
|
||||||
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name,
|
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name,
|
||||||
"50", "1.3.0", vesting_balance_type::son, true);
|
"50", "1.3.0", vesting_balance_type::son, true);
|
||||||
BOOST_CHECK(fixture_.generate_block());
|
fixture_.generate_block();
|
||||||
|
|
||||||
// create pay_vb vesting
|
// create pay_vb vesting
|
||||||
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name, "1", "1.3.0", vesting_balance_type::normal, true);
|
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name, "1", "1.3.0", vesting_balance_type::normal, true);
|
||||||
BOOST_CHECK(fixture_.generate_block());
|
fixture_.generate_block();
|
||||||
|
|
||||||
// check deposits are here
|
// check deposits are here
|
||||||
auto deposits = fixture_.con.wallet_api_ptr->get_vesting_balances(account_name);
|
auto deposits = fixture_.con.wallet_api_ptr->get_vesting_balances(account_name);
|
||||||
|
|
@ -169,10 +174,11 @@ BOOST_AUTO_TEST_CASE( cli_update_son )
|
||||||
|
|
||||||
// update SON signing key
|
// update SON signing key
|
||||||
sidechain_public_keys.clear();
|
sidechain_public_keys.clear();
|
||||||
con.wallet_api_ptr->update_son("sonmember", "http://sonmember_updated2", "TEST6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG", sidechain_public_keys, true);
|
std::string new_key = GRAPHENE_ADDRESS_PREFIX + std::string("6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG");
|
||||||
|
con.wallet_api_ptr->update_son("sonmember", "http://sonmember_updated2", new_key, sidechain_public_keys, true);
|
||||||
son_data = con.wallet_api_ptr->get_son("sonmember");
|
son_data = con.wallet_api_ptr->get_son("sonmember");
|
||||||
BOOST_CHECK(son_data.url == "http://sonmember_updated2");
|
BOOST_CHECK(son_data.url == "http://sonmember_updated2");
|
||||||
BOOST_CHECK(std::string(son_data.signing_key) == "TEST6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG");
|
BOOST_CHECK(std::string(son_data.signing_key) == new_key);
|
||||||
|
|
||||||
} catch( fc::exception& e ) {
|
} catch( fc::exception& e ) {
|
||||||
edump((e.to_detail_string()));
|
edump((e.to_detail_string()));
|
||||||
|
|
@ -421,7 +427,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test )
|
||||||
con.wallet_api_ptr->create_vesting_balance("nathan", "1000", "1.3.0", vesting_balance_type::gpos, true);
|
con.wallet_api_ptr->create_vesting_balance("nathan", "1000", "1.3.0", vesting_balance_type::gpos, true);
|
||||||
update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted,
|
update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted,
|
||||||
rejected, 2, true);
|
rejected, 2, true);
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
BOOST_CHECK(generate_maintenance_block());
|
BOOST_CHECK(generate_maintenance_block());
|
||||||
|
|
||||||
// Verify the votes
|
// Verify the votes
|
||||||
|
|
@ -461,7 +467,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test )
|
||||||
rejected.push_back("son1accnt");
|
rejected.push_back("son1accnt");
|
||||||
BOOST_CHECK_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted,
|
BOOST_CHECK_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted,
|
||||||
rejected, 1, true), fc::exception);
|
rejected, 1, true), fc::exception);
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// Verify the votes
|
// Verify the votes
|
||||||
son1_obj = con.wallet_api_ptr->get_son("son1account");
|
son1_obj = con.wallet_api_ptr->get_son("son1account");
|
||||||
|
|
@ -675,7 +681,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test )
|
||||||
|
|
||||||
// put SON in maintenance mode
|
// put SON in maintenance mode
|
||||||
con.wallet_api_ptr->request_son_maintenance(name, true);
|
con.wallet_api_ptr->request_son_maintenance(name, true);
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// check SON is in request_maintenance
|
// check SON is in request_maintenance
|
||||||
son_obj = con.wallet_api_ptr->get_son(name);
|
son_obj = con.wallet_api_ptr->get_son(name);
|
||||||
|
|
@ -683,7 +689,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test )
|
||||||
|
|
||||||
// restore SON activity
|
// restore SON activity
|
||||||
con.wallet_api_ptr->cancel_request_son_maintenance(name, true);
|
con.wallet_api_ptr->cancel_request_son_maintenance(name, true);
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// check SON is active
|
// check SON is active
|
||||||
son_obj = con.wallet_api_ptr->get_son(name);
|
son_obj = con.wallet_api_ptr->get_son(name);
|
||||||
|
|
@ -691,7 +697,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test )
|
||||||
|
|
||||||
// put SON in maintenance mode
|
// put SON in maintenance mode
|
||||||
con.wallet_api_ptr->request_son_maintenance(name, true);
|
con.wallet_api_ptr->request_son_maintenance(name, true);
|
||||||
BOOST_CHECK(generate_block());
|
generate_block();
|
||||||
|
|
||||||
// check SON is in request_maintenance
|
// check SON is in request_maintenance
|
||||||
son_obj = con.wallet_api_ptr->get_son(name);
|
son_obj = con.wallet_api_ptr->get_son(name);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,10 @@
|
||||||
|
|
||||||
using namespace graphene::chain::test;
|
using namespace graphene::chain::test;
|
||||||
|
|
||||||
|
//redefining parameters here to as per updated TESTNET parameters to verify unit test cases
|
||||||
uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700002;
|
uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700002;
|
||||||
|
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
@ -234,8 +236,9 @@ string database_fixture::generate_anon_acct_name()
|
||||||
void database_fixture::verify_asset_supplies( const database& db )
|
void database_fixture::verify_asset_supplies( const database& db )
|
||||||
{
|
{
|
||||||
//wlog("*** Begin asset supply verification ***");
|
//wlog("*** Begin asset supply verification ***");
|
||||||
const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db);
|
// It seems peerplays by default DO have core fee pool in genesis so commenting this out
|
||||||
BOOST_CHECK(core_asset_data.fee_pool == 0);
|
//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);
|
||||||
|
|
||||||
const auto& statistics_index = db.get_index_type<account_stats_index>().indices();
|
const auto& statistics_index = db.get_index_type<account_stats_index>().indices();
|
||||||
const auto& balance_index = db.get_index_type<account_balance_index>().indices();
|
const auto& balance_index = db.get_index_type<account_balance_index>().indices();
|
||||||
|
|
|
||||||
|
|
@ -1005,7 +1005,7 @@ BOOST_AUTO_TEST_CASE( issue_429_test )
|
||||||
|
|
||||||
const auto& fees = *db.get_global_properties().parameters.current_fees;
|
const auto& fees = *db.get_global_properties().parameters.current_fees;
|
||||||
auto fees_to_pay = fees.get<asset_create_operation>();
|
auto fees_to_pay = fees.get<asset_create_operation>();
|
||||||
|
|
||||||
{
|
{
|
||||||
signed_transaction tx;
|
signed_transaction tx;
|
||||||
asset_create_operation op;
|
asset_create_operation op;
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,10 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// advance to HF
|
// advance to HF
|
||||||
generate_blocks(HARDFORK_GPOS_TIME);
|
fc::time_point_sec GPOS_HARDFORK_TIME =
|
||||||
|
fc::time_point_sec(1581976800); // Use mainnet GPOS hardfork time
|
||||||
|
|
||||||
|
generate_blocks(GPOS_HARDFORK_TIME);
|
||||||
generate_block();
|
generate_block();
|
||||||
|
|
||||||
// update default gpos global parameters to 4 days
|
// update default gpos global parameters to 4 days
|
||||||
|
|
@ -905,7 +908,7 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting )
|
||||||
vote_for(voter1_id, worker.vote_for, voter1_private_key);
|
vote_for(voter1_id, worker.vote_for, voter1_private_key);
|
||||||
|
|
||||||
// first maint pass, coefficient will be 1
|
// first maint pass, coefficient will be 1
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
generate_blocks(GPOS_HARDFORK_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes
|
||||||
worker = worker_id_type()(db);
|
worker = worker_id_type()(db);
|
||||||
BOOST_CHECK_EQUAL(worker.total_votes_for, 100);
|
BOOST_CHECK_EQUAL(worker.total_votes_for, 100);
|
||||||
|
|
||||||
|
|
@ -925,8 +928,8 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting )
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
||||||
|
|
||||||
// worker is getting paid
|
// worker is getting paid
|
||||||
BOOST_CHECK_EQUAL(worker_id_type()(db).worker.get<vesting_balance_worker_type>().balance(db).balance.amount.value, 10);
|
BOOST_CHECK_EQUAL(worker_id_type()(db).worker.get<vesting_balance_worker_type>().balance(db).balance.amount.value, 5);
|
||||||
BOOST_CHECK_EQUAL(worker.worker.get<vesting_balance_worker_type>().balance(db).balance.amount.value, 10);
|
BOOST_CHECK_EQUAL(worker.worker.get<vesting_balance_worker_type>().balance(db).balance.amount.value, 5);
|
||||||
|
|
||||||
// second maint pass, coefficient will be 0.75
|
// second maint pass, coefficient will be 0.75
|
||||||
worker = worker_id_type()(db);
|
worker = worker_id_type()(db);
|
||||||
|
|
@ -966,7 +969,10 @@ BOOST_AUTO_TEST_CASE( account_multiple_vesting )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// advance to HF
|
// advance to HF
|
||||||
generate_blocks(HARDFORK_GPOS_TIME);
|
fc::time_point_sec GPOS_HARDFORK_TIME =
|
||||||
|
fc::time_point_sec(1581976800); // Use mainnet GPOS hardfork time
|
||||||
|
|
||||||
|
generate_blocks(GPOS_HARDFORK_TIME);
|
||||||
generate_block();
|
generate_block();
|
||||||
set_expiration(db, trx);
|
set_expiration(db, trx);
|
||||||
|
|
||||||
|
|
@ -1009,7 +1015,7 @@ BOOST_AUTO_TEST_CASE( account_multiple_vesting )
|
||||||
vote_for(sam_id, witness1.vote_id, sam_private_key);
|
vote_for(sam_id, witness1.vote_id, sam_private_key);
|
||||||
vote_for(patty_id, witness1.vote_id, patty_private_key);
|
vote_for(patty_id, witness1.vote_id, patty_private_key);
|
||||||
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
generate_blocks(GPOS_HARDFORK_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes
|
||||||
|
|
||||||
// amount in vested balanced will sum up as voting power
|
// amount in vested balanced will sum up as voting power
|
||||||
witness1 = witness_id_type(1)(db);
|
witness1 = witness_id_type(1)(db);
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE( check_tansaction_for_duplicated_operations, database_fixture )
|
BOOST_FIXTURE_TEST_SUITE( check_transaction_for_duplicated_operations, database_fixture )
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_twice )
|
BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_twice )
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_tw
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( check_passes_without_duplication )
|
||||||
ACTORS((alice))
|
ACTORS((alice))
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
||||||
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
|
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_the_same_operation_with_different_assets
|
||||||
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501))});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501))});
|
||||||
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
|
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplication_in_transaction_with_several_op
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
|
||||||
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
|
||||||
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_operations_types )
|
||||||
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
||||||
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
|
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_same_member_create_operations )
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_member_create_operations )
|
||||||
create_proposal(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
create_proposal(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1001), account_id_type(), "test url")});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1001), account_id_type(), "test url")});
|
||||||
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
|
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_several_operations_of_mixed_type )
|
||||||
make_committee_member_create_operation(asset(1002), account_id_type(), "test url")});
|
make_committee_member_create_operation(asset(1002), account_id_type(), "test url")});
|
||||||
|
|
||||||
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
|
||||||
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_duplicates_in_pending_transactions_list )
|
||||||
push_proposal(*this, moneyman, {duplicate});
|
push_proposal(*this, moneyman, {duplicate});
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate});
|
||||||
BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -323,7 +323,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_no_duplicates_in_pending_transactions_lis
|
||||||
push_proposal(*this, moneyman, {make_transfer_operation(alice.id, moneyman.get_id(), asset(100))});
|
push_proposal(*this, moneyman, {make_transfer_operation(alice.id, moneyman.get_id(), asset(100))});
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(alice.id, moneyman.get_id(), asset(101))});
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(alice.id, moneyman.get_id(), asset(101))});
|
||||||
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
|
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_several_transactions_with_duplicates_in_pe
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate,
|
auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate,
|
||||||
make_transfer_operation(alice.id, moneyman.get_id(), asset(102))});
|
make_transfer_operation(alice.id, moneyman.get_id(), asset(102))});
|
||||||
BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
|
BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_duplicated_betting_market_or_group )
|
||||||
create_proposal(*this, { pcop1, pcop2 });
|
create_proposal(*this, { pcop1, pcop2 });
|
||||||
|
|
||||||
auto trx = make_signed_transaction_with_proposed_operation(*this, { pcop1, pcop2 });
|
auto trx = make_signed_transaction_with_proposed_operation(*this, { pcop1, pcop2 });
|
||||||
BOOST_CHECK_NO_THROW( db.check_tansaction_for_duplicated_operations(trx) );
|
BOOST_CHECK_NO_THROW( db.check_transaction_for_duplicated_operations(trx) );
|
||||||
}
|
}
|
||||||
catch( const fc::exception& e )
|
catch( const fc::exception& e )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue