From cb99aaa0cf11edff3f6bcb1896ae02bcde006dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miha=20=C4=8Can=C4=8Dula?= Date: Tue, 20 Aug 2019 15:24:32 +0200 Subject: [PATCH] Adapt to variant API with `max_depth` argument --- libraries/app/api.cpp | 2 +- .../chain/betting_market_group_object.cpp | 42 +++++++------- libraries/chain/betting_market_object.cpp | 28 +++++----- libraries/chain/db_debug.cpp | 4 +- libraries/chain/db_init.cpp | 4 +- libraries/chain/event_object.cpp | 32 +++++------ libraries/chain/game_object.cpp | 32 +++++------ .../graphene/chain/betting_market_object.hpp | 16 +++--- .../include/graphene/chain/event_object.hpp | 8 +-- .../include/graphene/chain/game_object.hpp | 8 +-- .../include/graphene/chain/match_object.hpp | 8 +-- .../graphene/chain/tournament_object.hpp | 8 +-- libraries/chain/match_object.cpp | 48 ++++++++-------- libraries/chain/tournament_object.cpp | 40 ++++++------- libraries/plugins/witness/witness.cpp | 2 +- libraries/wallet/wallet.cpp | 53 +++++------------- programs/debug_node/main.cpp | 8 +-- tests/betting/betting_tests.cpp | 56 +++++++++---------- tests/tests/network_node_api_tests.cpp | 2 +- 19 files changed, 189 insertions(+), 212 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 7e47a2cc..e38edff4 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -218,7 +218,7 @@ namespace graphene { namespace app { if (_on_pending_transaction) { - _on_pending_transaction(fc::variant(transaction)); + _on_pending_transaction(fc::variant(transaction, GRAPHENE_MAX_NESTED_OBJECTS)); } }); diff --git a/libraries/chain/betting_market_group_object.cpp b/libraries/chain/betting_market_group_object.cpp index 71135e07..2ac7d7a4 100644 --- a/libraries/chain/betting_market_group_object.cpp +++ b/libraries/chain/betting_market_group_object.cpp @@ -543,35 +543,35 @@ void betting_market_group_object::dispatch_new_status(database& db, betting_mark namespace fc { // Manually reflect betting_market_group_object to variant to properly reflect "state" - void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v) + void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth) { fc::mutable_variant_object o; - o("id", betting_market_group_obj.id) - ("description", betting_market_group_obj.description) - ("event_id", betting_market_group_obj.event_id) - ("rules_id", betting_market_group_obj.rules_id) - ("asset_id", betting_market_group_obj.asset_id) - ("total_matched_bets_amount", betting_market_group_obj.total_matched_bets_amount) - ("never_in_play", betting_market_group_obj.never_in_play) - ("delay_before_settling", betting_market_group_obj.delay_before_settling) - ("settling_time", betting_market_group_obj.settling_time) - ("status", betting_market_group_obj.get_status()); + o("id", fc::variant(betting_market_group_obj.id, max_depth)) + ("description", fc::variant(betting_market_group_obj.description, max_depth)) + ("event_id", fc::variant(betting_market_group_obj.event_id, max_depth)) + ("rules_id", fc::variant(betting_market_group_obj.rules_id, max_depth)) + ("asset_id", fc::variant(betting_market_group_obj.asset_id, max_depth)) + ("total_matched_bets_amount", fc::variant(betting_market_group_obj.total_matched_bets_amount, max_depth)) + ("never_in_play", fc::variant(betting_market_group_obj.never_in_play, max_depth)) + ("delay_before_settling", fc::variant(betting_market_group_obj.delay_before_settling, max_depth)) + ("settling_time", fc::variant(betting_market_group_obj.settling_time, max_depth)) + ("status", fc::variant(betting_market_group_obj.get_status(), max_depth)); v = o; } // Manually reflect betting_market_group_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj) + void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth) { - betting_market_group_obj.id = v["id"].as(); - betting_market_group_obj.description = v["description"].as(); - betting_market_group_obj.event_id = v["event_id"].as(); - betting_market_group_obj.asset_id = v["asset_id"].as(); - betting_market_group_obj.total_matched_bets_amount = v["total_matched_bets_amount"].as(); - betting_market_group_obj.never_in_play = v["never_in_play"].as(); - betting_market_group_obj.delay_before_settling = v["delay_before_settling"].as(); - betting_market_group_obj.settling_time = v["settling_time"].as>(); - graphene::chain::betting_market_group_status status = v["status"].as(); + betting_market_group_obj.id = v["id"].as( max_depth ); + betting_market_group_obj.description = v["description"].as( max_depth ); + betting_market_group_obj.event_id = v["event_id"].as( max_depth ); + betting_market_group_obj.asset_id = v["asset_id"].as( max_depth ); + betting_market_group_obj.total_matched_bets_amount = v["total_matched_bets_amount"].as( max_depth ); + betting_market_group_obj.never_in_play = v["never_in_play"].as( max_depth ); + betting_market_group_obj.delay_before_settling = v["delay_before_settling"].as( max_depth ); + betting_market_group_obj.settling_time = v["settling_time"].as>( max_depth ); + graphene::chain::betting_market_group_status status = v["status"].as( max_depth ); const_cast(betting_market_group_obj.my->state_machine.current_state())[0] = (int)status; } } //end namespace fc diff --git a/libraries/chain/betting_market_object.cpp b/libraries/chain/betting_market_object.cpp index cb0e006e..d5efd56c 100644 --- a/libraries/chain/betting_market_object.cpp +++ b/libraries/chain/betting_market_object.cpp @@ -468,28 +468,28 @@ void betting_market_object::on_canceled_event(database& db) namespace fc { // Manually reflect betting_market_object to variant to properly reflect "state" - void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v) + void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v, uint32_t max_depth) { fc::mutable_variant_object o; - o("id", event_obj.id) - ("group_id", event_obj.group_id) - ("description", event_obj.description) - ("payout_condition", event_obj.payout_condition) - ("resolution", event_obj.resolution) - ("status", event_obj.get_status()); + o("id", fc::variant(event_obj.id, max_depth) ) + ("group_id", fc::variant(event_obj.group_id, max_depth)) + ("description", fc::variant(event_obj.description, max_depth)) + ("payout_condition", fc::variant(event_obj.payout_condition, max_depth)) + ("resolution", fc::variant(event_obj.resolution, max_depth)) + ("status", fc::variant(event_obj.get_status(), max_depth)); v = o; } // Manually reflect betting_market_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj) + void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj, uint32_t max_depth) { - event_obj.id = v["id"].as(); - event_obj.group_id = v["name"].as(); - event_obj.description = v["description"].as(); - event_obj.payout_condition = v["payout_condition"].as(); - event_obj.resolution = v["resolution"].as>(); - graphene::chain::betting_market_status status = v["status"].as(); + event_obj.id = v["id"].as( max_depth ); + event_obj.group_id = v["name"].as( max_depth ); + event_obj.description = v["description"].as( max_depth ); + event_obj.payout_condition = v["payout_condition"].as( max_depth ); + event_obj.resolution = v["resolution"].as>( max_depth ); + graphene::chain::betting_market_status status = v["status"].as( max_depth ); const_cast(event_obj.my->state_machine.current_state())[0] = (int)status; } } //end namespace fc diff --git a/libraries/chain/db_debug.cpp b/libraries/chain/db_debug.cpp index 2373eab6..0fa5eb58 100644 --- a/libraries/chain/db_debug.cpp +++ b/libraries/chain/db_debug.cpp @@ -118,10 +118,10 @@ void debug_apply_update( database& db, const fc::variant_object& vo ) auto it_id = vo.find("id"); FC_ASSERT( it_id != vo.end() ); - from_variant( it_id->value(), oid ); + from_variant( it_id->value(), oid, GRAPHENE_MAX_NESTED_OBJECTS ); action = ( vo.size() == 1 ) ? db_action_delete : db_action_write; - from_variant( vo["id"], oid ); + from_variant( vo["id"], oid, GRAPHENE_MAX_NESTED_OBJECTS ); if( vo.size() == 1 ) action = db_action_delete; auto it_action = vo.find("_action" ); diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index 99343682..1d2df656 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -739,7 +739,7 @@ void database::init_genesis(const genesis_state_type& genesis_state) vbo.owner = get_account_id(account.name); vbo.balance = asset(vesting_balance.amount, get_asset_id(vesting_balance.asset_symbol)); if (vesting_balance.policy_type == "linear") { - auto initial_linear_vesting_policy = vesting_balance.policy.as(); + auto initial_linear_vesting_policy = vesting_balance.policy.as( 20 ); linear_vesting_policy new_vesting_policy; new_vesting_policy.begin_timestamp = initial_linear_vesting_policy.begin_timestamp; new_vesting_policy.vesting_cliff_seconds = initial_linear_vesting_policy.vesting_cliff_seconds; @@ -747,7 +747,7 @@ void database::init_genesis(const genesis_state_type& genesis_state) new_vesting_policy.begin_balance = initial_linear_vesting_policy.begin_balance; vbo.policy = new_vesting_policy; } else if (vesting_balance.policy_type == "cdd") { - auto initial_cdd_vesting_policy = vesting_balance.policy.as(); + auto initial_cdd_vesting_policy = vesting_balance.policy.as( 20 ); cdd_vesting_policy new_vesting_policy; new_vesting_policy.vesting_seconds = initial_cdd_vesting_policy.vesting_seconds; new_vesting_policy.coin_seconds_earned = initial_cdd_vesting_policy.coin_seconds_earned; diff --git a/libraries/chain/event_object.cpp b/libraries/chain/event_object.cpp index 99caf904..4c2fce14 100644 --- a/libraries/chain/event_object.cpp +++ b/libraries/chain/event_object.cpp @@ -553,30 +553,30 @@ namespace graphene { namespace chain { namespace fc { // Manually reflect event_object to variant to properly reflect "state" - void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v) + void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth) { fc::mutable_variant_object o; - o("id", event_obj.id) - ("name", event_obj.name) - ("season", event_obj.season) - ("start_time", event_obj.start_time) - ("event_group_id", event_obj.event_group_id) - ("scores", event_obj.scores) - ("status", event_obj.get_status()); + o("id", fc::variant(event_obj.id, max_depth)) + ("name", fc::variant(event_obj.name, max_depth)) + ("season", fc::variant(event_obj.season, max_depth)) + ("start_time", fc::variant(event_obj.start_time, max_depth)) + ("event_group_id", fc::variant(event_obj.event_group_id, max_depth)) + ("scores", fc::variant(event_obj.scores, max_depth)) + ("status", fc::variant(event_obj.get_status(), max_depth)); v = o; } // Manually reflect event_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj) + void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth) { - event_obj.id = v["id"].as(); - event_obj.name = v["name"].as(); - event_obj.season = v["season"].as(); - event_obj.start_time = v["start_time"].as >(); - event_obj.event_group_id = v["event_group_id"].as(); - event_obj.scores = v["scores"].as>(); - graphene::chain::event_status status = v["status"].as(); + event_obj.id = v["id"].as( max_depth ); + event_obj.name = v["name"].as( max_depth ); + event_obj.season = v["season"].as( max_depth ); + event_obj.start_time = v["start_time"].as >( max_depth ); + event_obj.event_group_id = v["event_group_id"].as( max_depth ); + event_obj.scores = v["scores"].as>( max_depth ); + graphene::chain::event_status status = v["status"].as( max_depth ); const_cast(event_obj.my->state_machine.current_state())[0] = (int)status; } } //end namespace fc diff --git a/libraries/chain/game_object.cpp b/libraries/chain/game_object.cpp index 02612a77..5874fd9e 100644 --- a/libraries/chain/game_object.cpp +++ b/libraries/chain/game_object.cpp @@ -549,33 +549,33 @@ namespace graphene { namespace chain { namespace fc { // Manually reflect game_object to variant to properly reflect "state" - void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v) + void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth) { fc_elog(fc::logger::get("tournament"), "In game_obj to_variant"); elog("In game_obj to_variant"); fc::mutable_variant_object o; - o("id", game_obj.id) - ("match_id", game_obj.match_id) - ("players", game_obj.players) - ("winners", game_obj.winners) - ("game_details", game_obj.game_details) - ("next_timeout", game_obj.next_timeout) - ("state", game_obj.get_state()); + o("id", fc::variant(game_obj.id, max_depth )) + ("match_id", fc::variant(game_obj.match_id, max_depth )) + ("players", fc::variant(game_obj.players, max_depth )) + ("winners", fc::variant(game_obj.winners, max_depth )) + ("game_details", fc::variant(game_obj.game_details, max_depth )) + ("next_timeout", fc::variant(game_obj.next_timeout, max_depth )) + ("state", fc::variant(game_obj.get_state(), max_depth )); v = o; } // Manually reflect game_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj) + void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth) { fc_elog(fc::logger::get("tournament"), "In game_obj from_variant"); - game_obj.id = v["id"].as(); - game_obj.match_id = v["match_id"].as(); - game_obj.players = v["players"].as >(); - game_obj.winners = v["winners"].as >(); - game_obj.game_details = v["game_details"].as(); - game_obj.next_timeout = v["next_timeout"].as >(); - graphene::chain::game_state state = v["state"].as(); + game_obj.id = v["id"].as( max_depth ); + game_obj.match_id = v["match_id"].as( max_depth ); + game_obj.players = v["players"].as >( max_depth ); + game_obj.winners = v["winners"].as >( max_depth ); + game_obj.game_details = v["game_details"].as( max_depth ); + game_obj.next_timeout = v["next_timeout"].as >( max_depth ); + graphene::chain::game_state state = v["state"].as( max_depth ); const_cast(game_obj.my->state_machine.current_state())[0] = (int)state; } } //end namespace fc diff --git a/libraries/chain/include/graphene/chain/betting_market_object.hpp b/libraries/chain/include/graphene/chain/betting_market_object.hpp index cb815739..36e8e664 100644 --- a/libraries/chain/include/graphene/chain/betting_market_object.hpp +++ b/libraries/chain/include/graphene/chain/betting_market_object.hpp @@ -37,10 +37,10 @@ namespace graphene { namespace chain { } } namespace fc { - void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj); - void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj); + void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth = 1); + void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth = 1); } //end namespace fc namespace graphene { namespace chain { @@ -110,8 +110,8 @@ class betting_market_group_object : public graphene::db::abstract_object< bettin template friend Stream& operator>>( Stream& s, betting_market_group_object& betting_market_group_obj ); - friend void ::fc::to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj); + friend void ::fc::to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); @@ -166,8 +166,8 @@ class betting_market_object : public graphene::db::abstract_object< betting_mark template friend Stream& operator>>( Stream& s, betting_market_object& betting_market_obj ); - friend void ::fc::to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj); + friend void ::fc::to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); diff --git a/libraries/chain/include/graphene/chain/event_object.hpp b/libraries/chain/include/graphene/chain/event_object.hpp index c8c9b493..4258cbb1 100644 --- a/libraries/chain/include/graphene/chain/event_object.hpp +++ b/libraries/chain/include/graphene/chain/event_object.hpp @@ -36,8 +36,8 @@ namespace graphene { namespace chain { } } namespace fc { - void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj); + void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth = 1); } //end namespace fc namespace graphene { namespace chain { @@ -77,8 +77,8 @@ class event_object : public graphene::db::abstract_object< event_object > template friend Stream& operator>>( Stream& s, event_object& event_obj ); - friend void ::fc::to_variant(const graphene::chain::event_object& event_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::event_object& event_obj); + friend void ::fc::to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); diff --git a/libraries/chain/include/graphene/chain/game_object.hpp b/libraries/chain/include/graphene/chain/game_object.hpp index eff04023..abef1444 100644 --- a/libraries/chain/include/graphene/chain/game_object.hpp +++ b/libraries/chain/include/graphene/chain/game_object.hpp @@ -36,8 +36,8 @@ namespace graphene { namespace chain { } } namespace fc { - void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj); + void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth = 1); } //end namespace fc namespace graphene { namespace chain { @@ -92,8 +92,8 @@ namespace graphene { namespace chain { template friend Stream& operator>>( Stream& s, game_object& game_obj ); - friend void ::fc::to_variant(const graphene::chain::game_object& game_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::game_object& game_obj); + friend void ::fc::to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); diff --git a/libraries/chain/include/graphene/chain/match_object.hpp b/libraries/chain/include/graphene/chain/match_object.hpp index 67146e38..72c346a7 100644 --- a/libraries/chain/include/graphene/chain/match_object.hpp +++ b/libraries/chain/include/graphene/chain/match_object.hpp @@ -12,8 +12,8 @@ namespace graphene { namespace chain { } } namespace fc { - void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj); + void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth = 1); } //end namespace fc namespace graphene { namespace chain { @@ -84,8 +84,8 @@ namespace graphene { namespace chain { template friend Stream& operator>>( Stream& s, match_object& match_obj ); - friend void ::fc::to_variant(const graphene::chain::match_object& match_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::match_object& match_obj); + friend void ::fc::to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); diff --git a/libraries/chain/include/graphene/chain/tournament_object.hpp b/libraries/chain/include/graphene/chain/tournament_object.hpp index ffde72f8..140770e2 100644 --- a/libraries/chain/include/graphene/chain/tournament_object.hpp +++ b/libraries/chain/include/graphene/chain/tournament_object.hpp @@ -12,8 +12,8 @@ namespace graphene { namespace chain { } } namespace fc { - void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v); - void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj); + void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth = 1); + void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth = 1); } //end namespace fc namespace graphene { namespace chain { @@ -108,8 +108,8 @@ namespace graphene { namespace chain { template friend Stream& operator>>( Stream& s, tournament_object& tournament_obj ); - friend void ::fc::to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v); - friend void ::fc::from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj); + friend void ::fc::to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth); + friend void ::fc::from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth); void pack_impl(std::ostream& stream) const; void unpack_impl(std::istream& stream); diff --git a/libraries/chain/match_object.cpp b/libraries/chain/match_object.cpp index 7819d21e..e11f0e8a 100644 --- a/libraries/chain/match_object.cpp +++ b/libraries/chain/match_object.cpp @@ -364,41 +364,41 @@ namespace graphene { namespace chain { namespace fc { // Manually reflect match_object to variant to properly reflect "state" - void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v) + void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth) { try { fc_elog(fc::logger::get("tournament"), "In match_obj to_variant"); elog("In match_obj to_variant"); fc::mutable_variant_object o; - o("id", match_obj.id) - ("tournament_id", match_obj.tournament_id) - ("players", match_obj.players) - ("games", match_obj.games) - ("game_winners", match_obj.game_winners) - ("number_of_wins", match_obj.number_of_wins) - ("number_of_ties", match_obj.number_of_ties) - ("match_winners", match_obj.match_winners) - ("start_time", match_obj.start_time) - ("end_time", match_obj.end_time) - ("state", match_obj.get_state()); + o("id", fc::variant(match_obj.id, max_depth)) + ("tournament_id", fc::variant(match_obj.tournament_id, max_depth)) + ("players", fc::variant(match_obj.players, max_depth)) + ("games", fc::variant(match_obj.games, max_depth)) + ("game_winners", fc::variant(match_obj.game_winners, max_depth)) + ("number_of_wins", fc::variant(match_obj.number_of_wins, max_depth)) + ("number_of_ties", fc::variant(match_obj.number_of_ties, max_depth)) + ("match_winners", fc::variant(match_obj.match_winners, max_depth)) + ("start_time", fc::variant(match_obj.start_time, max_depth)) + ("end_time", fc::variant(match_obj.end_time, max_depth)) + ("state", fc::variant(match_obj.get_state(), max_depth)); v = o; } FC_RETHROW_EXCEPTIONS(warn, "") } // Manually reflect match_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj) + void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth) { try { fc_elog(fc::logger::get("tournament"), "In match_obj from_variant"); - match_obj.id = v["id"].as(); - match_obj.tournament_id = v["tournament_id"].as(); - match_obj.players = v["players"].as >(); - match_obj.games = v["games"].as >(); - match_obj.game_winners = v["game_winners"].as > >(); - match_obj.number_of_wins = v["number_of_wins"].as >(); - match_obj.number_of_ties = v["number_of_ties"].as(); - match_obj.match_winners = v["match_winners"].as >(); - match_obj.start_time = v["start_time"].as(); - match_obj.end_time = v["end_time"].as >(); - graphene::chain::match_state state = v["state"].as(); + match_obj.id = v["id"].as( max_depth ); + match_obj.tournament_id = v["tournament_id"].as( max_depth ); + match_obj.players = v["players"].as >( max_depth ); + match_obj.games = v["games"].as >( max_depth ); + match_obj.game_winners = v["game_winners"].as > >( max_depth ); + match_obj.number_of_wins = v["number_of_wins"].as >( max_depth ); + match_obj.number_of_ties = v["number_of_ties"].as( max_depth ); + match_obj.match_winners = v["match_winners"].as >( max_depth ); + match_obj.start_time = v["start_time"].as( max_depth ); + match_obj.end_time = v["end_time"].as >( max_depth ); + graphene::chain::match_state state = v["state"].as( max_depth ); const_cast(match_obj.my->state_machine.current_state())[0] = (int)state; } FC_RETHROW_EXCEPTIONS(warn, "") } } //end namespace fc diff --git a/libraries/chain/tournament_object.cpp b/libraries/chain/tournament_object.cpp index c1b53f79..ad64b34f 100644 --- a/libraries/chain/tournament_object.cpp +++ b/libraries/chain/tournament_object.cpp @@ -722,37 +722,37 @@ namespace graphene { namespace chain { namespace fc { // Manually reflect tournament_object to variant to properly reflect "state" - void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v) + void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth) { fc_elog(fc::logger::get("tournament"), "In tournament_obj to_variant"); elog("In tournament_obj to_variant"); fc::mutable_variant_object o; - o("id", tournament_obj.id) - ("creator", tournament_obj.creator) - ("options", tournament_obj.options) - ("start_time", tournament_obj.start_time) - ("end_time", tournament_obj.end_time) - ("prize_pool", tournament_obj.prize_pool) - ("registered_players", tournament_obj.registered_players) - ("tournament_details_id", tournament_obj.tournament_details_id) - ("state", tournament_obj.get_state()); + o("id", fc::variant(tournament_obj.id, max_depth)) + ("creator", fc::variant(tournament_obj.creator, max_depth)) + ("options", fc::variant(tournament_obj.options, max_depth)) + ("start_time", fc::variant(tournament_obj.start_time, max_depth)) + ("end_time", fc::variant(tournament_obj.end_time, max_depth)) + ("prize_pool", fc::variant(tournament_obj.prize_pool, max_depth)) + ("registered_players", fc::variant(tournament_obj.registered_players, max_depth)) + ("tournament_details_id", fc::variant(tournament_obj.tournament_details_id, max_depth)) + ("state", fc::variant(tournament_obj.get_state(), max_depth)); v = o; } // Manually reflect tournament_object to variant to properly reflect "state" - void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj) + void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth) { fc_elog(fc::logger::get("tournament"), "In tournament_obj from_variant"); - tournament_obj.id = v["id"].as(); - tournament_obj.creator = v["creator"].as(); - tournament_obj.options = v["options"].as(); - tournament_obj.start_time = v["start_time"].as >(); - tournament_obj.end_time = v["end_time"].as >(); - tournament_obj.prize_pool = v["prize_pool"].as(); - tournament_obj.registered_players = v["registered_players"].as(); - tournament_obj.tournament_details_id = v["tournament_details_id"].as(); - graphene::chain::tournament_state state = v["state"].as(); + tournament_obj.id = v["id"].as( max_depth ); + tournament_obj.creator = v["creator"].as( max_depth ); + tournament_obj.options = v["options"].as( max_depth ); + tournament_obj.start_time = v["start_time"].as >( max_depth ); + tournament_obj.end_time = v["end_time"].as >( max_depth ); + tournament_obj.prize_pool = v["prize_pool"].as( max_depth ); + tournament_obj.registered_players = v["registered_players"].as( max_depth ); + tournament_obj.tournament_details_id = v["tournament_details_id"].as( max_depth ); + graphene::chain::tournament_state state = v["state"].as( max_depth ); const_cast(tournament_obj.my->state_machine.current_state())[0] = (int)state; } } //end namespace fc diff --git a/libraries/plugins/witness/witness.cpp b/libraries/plugins/witness/witness.cpp index 88b6ba3e..3125d8e2 100644 --- a/libraries/plugins/witness/witness.cpp +++ b/libraries/plugins/witness/witness.cpp @@ -93,7 +93,7 @@ void witness_plugin::plugin_initialize(const boost::program_options::variables_m _options = &options; LOAD_VALUE_SET(options, "witness-id", _witnesses, chain::witness_id_type) if (options.count("witness-ids")) - boost::insert(_witnesses, fc::json::from_string(options.at("witness-ids").as()).as>()); + boost::insert(_witnesses, fc::json::from_string(options.at("witness-ids").as()).as>( 5 )); if( options.count("private-key") ) { diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 4d473df2..af765947 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -378,8 +378,8 @@ private: { try { - object_id_type id = changed_object_variant["id"].as(); - tournament_object current_tournament_obj = changed_object_variant.as(); + object_id_type id = changed_object_variant["id"].as( GRAPHENE_MAX_NESTED_OBJECTS ); + tournament_object current_tournament_obj = changed_object_variant.as( GRAPHENE_MAX_NESTED_OBJECTS ); auto tournament_cache_iter = tournament_cache.find(id); if (tournament_cache_iter != tournament_cache.end()) { @@ -411,8 +411,8 @@ private: } try { - object_id_type id = changed_object_variant["id"].as(); - match_object current_match_obj = changed_object_variant.as(); + object_id_type id = changed_object_variant["id"].as( GRAPHENE_MAX_NESTED_OBJECTS ); + match_object current_match_obj = changed_object_variant.as( GRAPHENE_MAX_NESTED_OBJECTS ); auto match_cache_iter = match_cache.find(id); if (match_cache_iter != match_cache.end()) { @@ -436,8 +436,8 @@ private: } try { - object_id_type id = changed_object_variant["id"].as(); - game_object current_game_obj = changed_object_variant.as(); + object_id_type id = changed_object_variant["id"].as( GRAPHENE_MAX_NESTED_OBJECTS ); + game_object current_game_obj = changed_object_variant.as( GRAPHENE_MAX_NESTED_OBJECTS ); auto game_cache_iter = game_cache.find(id); if (game_cache_iter != game_cache.end()) { @@ -460,10 +460,10 @@ private: } try { - object_id_type id = changed_object_variant["id"].as(); + object_id_type id = changed_object_variant["id"].as( GRAPHENE_MAX_NESTED_OBJECTS ); if (_wallet.my_accounts.find(id) != _wallet.my_accounts.end()) { - account_object account = changed_object_variant.as(); + account_object account = changed_object_variant.as( GRAPHENE_MAX_NESTED_OBJECTS ); _wallet.update_account(account); } continue; @@ -2516,29 +2516,6 @@ public: return ss.str(); }; - m["get_account_history_by_operations"] = [this](variant result, const fc::variants& a) { - auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); - std::stringstream ss; - ss << "total_count : "; - ss << r.total_count; - ss << " \n"; - ss << "result_count : "; - ss << r.result_count; - ss << " \n"; - for (operation_detail_ex& d : r.details) { - operation_history_object& i = d.op; - auto b = _remote_db->get_block_header(i.block_num); - FC_ASSERT(b); - ss << b->timestamp.to_iso_string() << " "; - i.op.visit(operation_printer(ss, *this, i.result)); - ss << " transaction_id : "; - ss << d.transaction_id.str(); - ss << " \n"; - } - - return ss.str(); - }; - m["list_account_balances"] = [this](variant result, const fc::variants& a) { auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); @@ -2558,7 +2535,7 @@ public: { std::stringstream ss; - auto balances = result.as>(); + auto balances = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); for (const account_balance_object& balance: balances) { const account_object& account = get_account(balance.owner); @@ -2634,14 +2611,14 @@ public: }; m["get_upcoming_tournaments"] = m["get_tournaments"] = m["get_tournaments_by_state"] = [this](variant result, const fc::variants& a) { - const vector tournaments = result.as >(); + const vector tournaments = result.as >( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; ss << "ID GAME BUY IN PLAYERS\n"; ss << "====================================================================================\n"; for( const tournament_object& tournament_obj : tournaments ) { asset_object buy_in_asset = get_asset(tournament_obj.options.buy_in.asset_id); - ss << fc::variant(tournament_obj.id).as() << " " + ss << fc::variant(tournament_obj.id, 1).as( 1 ) << " " << buy_in_asset.amount_to_pretty_string(tournament_obj.options.buy_in.amount) << " " << tournament_obj.options.number_of_players << " players\n"; switch (tournament_obj.get_state()) @@ -2684,8 +2661,8 @@ public: { std::stringstream ss; - tournament_object tournament = result.as(); - tournament_details_object tournament_details = _remote_db->get_objects({result["tournament_details_id"].as()})[0].as(); + tournament_object tournament = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); + tournament_details_object tournament_details = _remote_db->get_objects({result["tournament_details_id"].as( 5 )})[0].as( 5 ); tournament_state state = tournament.get_state(); if (state == tournament_state::accepting_registrations) { @@ -2994,7 +2971,7 @@ public: const chain_parameters& current_params = get_global_properties().parameters; asset_update_dividend_operation changed_op; fc::reflector::visit( - fc::from_variant_visitor( changed_values, changed_op ) + fc::from_variant_visitor( changed_values, changed_op, GRAPHENE_MAX_NESTED_OBJECTS ) ); optional asset_to_update = find_asset(changed_op.asset_to_update); @@ -5817,7 +5794,7 @@ vector wallet_api::get_tournaments_by_state(tournament_id_typ tournament_object wallet_api::get_tournament(tournament_id_type id) { - return my->_remote_db->get_objects({id})[0].as(); + return my->_remote_db->get_objects({id})[0].as( GRAPHENE_MAX_NESTED_OBJECTS ); } signed_transaction wallet_api::rps_throw(game_id_type game_id, diff --git a/programs/debug_node/main.cpp b/programs/debug_node/main.cpp index 7c3d358a..c94d3fd2 100644 --- a/programs/debug_node/main.cpp +++ b/programs/debug_node/main.cpp @@ -261,8 +261,8 @@ fc::optional load_logging_config_from_ini_file(const fc::pat console_appender_config.level_colors.emplace_back( fc::console_appender::level_color(fc::log_level::error, fc::console_appender::color::cyan)); - console_appender_config.stream = fc::variant(stream_name).as(); - logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config))); + console_appender_config.stream = fc::variant(stream_name, 1).as(1); + logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config, 20))); found_logging_config = true; } else if (boost::starts_with(section_name, file_appender_section_prefix)) @@ -281,7 +281,7 @@ fc::optional load_logging_config_from_ini_file(const fc::pat file_appender_config.rotate = true; file_appender_config.rotation_interval = fc::hours(1); file_appender_config.rotation_limit = fc::days(1); - logging_config.appenders.push_back(fc::appender_config(file_appender_name, "file", fc::variant(file_appender_config))); + logging_config.appenders.push_back(fc::appender_config(file_appender_name, "file", fc::variant(file_appender_config, 20))); found_logging_config = true; } else if (boost::starts_with(section_name, logger_section_prefix)) @@ -290,7 +290,7 @@ fc::optional load_logging_config_from_ini_file(const fc::pat std::string level_string = section_tree.get("level"); std::string appenders_string = section_tree.get("appenders"); fc::logger_config logger_config(logger_name); - logger_config.level = fc::variant(level_string).as(); + logger_config.level = fc::variant(level_string, 1).as(1); boost::split(logger_config.appenders, appenders_string, boost::is_any_of(" ,"), boost::token_compress_on); diff --git a/tests/betting/betting_tests.cpp b/tests/betting/betting_tests.cpp index 3988c71f..7ac602a7 100644 --- a/tests/betting/betting_tests.cpp +++ b/tests/betting/betting_tests.cpp @@ -962,7 +962,7 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test) fc::variants objects_from_bookie = bookie_api.get_objects({automatically_canceled_bet_id}); idump((objects_from_bookie)); BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 1u); - BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as() == automatically_canceled_bet_id, "Bookie Plugin didn't return a deleted bet it"); + BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as(1) == automatically_canceled_bet_id, "Bookie Plugin didn't return a deleted bet it"); // lay 47 at 1.94 odds (50:47) -- this bet should go on the order books normally bet_id_type first_bet_on_books = place_bet(alice_id, capitals_win_market.id, bet_type::lay, asset(47, asset_id_type()), 194 * GRAPHENE_BETTING_ODDS_PRECISION / 100); @@ -971,7 +971,7 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test) objects_from_bookie = bookie_api.get_objects({first_bet_on_books}); idump((objects_from_bookie)); BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 1u); - BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as() == first_bet_on_books, "Bookie Plugin didn't return a bet that is currently on the books"); + BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as(1) == first_bet_on_books, "Bookie Plugin didn't return a bet that is currently on the books"); // place a bet that exactly matches 'first_bet_on_books', should result in empty books (thus, no bet_objects from the blockchain) bet_id_type matching_bet = place_bet(bob_id, capitals_win_market.id, bet_type::back, asset(50, asset_id_type()), 194 * GRAPHENE_BETTING_ODDS_PRECISION / 100); @@ -982,8 +982,8 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test) objects_from_bookie = bookie_api.get_objects({first_bet_on_books, matching_bet}); idump((objects_from_bookie)); BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 2u); - BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as() == first_bet_on_books, "Bookie Plugin didn't return a bet that has been filled"); - BOOST_CHECK_MESSAGE(objects_from_bookie[1]["id"].as() == matching_bet, "Bookie Plugin didn't return a bet that has been filled"); + BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as(1) == first_bet_on_books, "Bookie Plugin didn't return a bet that has been filled"); + BOOST_CHECK_MESSAGE(objects_from_bookie[1]["id"].as(1) == matching_bet, "Bookie Plugin didn't return a bet that has been filled"); update_betting_market_group(moneyline_betting_markets.id, _status = betting_market_group_status::closed); @@ -1249,7 +1249,7 @@ BOOST_AUTO_TEST_CASE( chained_market_create_test ) for (const witness_id_type& witness_id : active_witnesses) { - BOOST_TEST_MESSAGE("Approving sport+competitors creation from witness " << fc::variant(witness_id).as()); + BOOST_TEST_MESSAGE("Approving sport+competitors creation from witness " << fc::variant(witness_id, 1).as(1)); const witness_object& witness = witness_id(db); const account_object& witness_account = witness.witness_account(db); @@ -2077,7 +2077,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_1) // removed. fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); } FC_LOG_AND_RETHROW() } @@ -2138,12 +2138,12 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_1_with_delay) blackhawks_win_market_id}); idump((objects_from_bookie)); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); - BOOST_CHECK_EQUAL(objects_from_bookie[1]["status"].as(), "settled"); - BOOST_CHECK_EQUAL(objects_from_bookie[2]["status"].as(), "settled"); - BOOST_CHECK_EQUAL(objects_from_bookie[2]["resolution"].as(), "win"); - BOOST_CHECK_EQUAL(objects_from_bookie[3]["status"].as(), "settled"); - BOOST_CHECK_EQUAL(objects_from_bookie[3]["resolution"].as(), "not_win"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[1]["status"].as(1), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[2]["status"].as(1), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[2]["resolution"].as(1), "win"); + BOOST_CHECK_EQUAL(objects_from_bookie[3]["status"].as(1), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[3]["resolution"].as(1), "not_win"); } FC_LOG_AND_RETHROW() } @@ -2230,7 +2230,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_2) // removed. fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); } FC_LOG_AND_RETHROW() } @@ -2318,7 +2318,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_2_never_in_play) // removed. fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); } FC_LOG_AND_RETHROW() } @@ -2393,7 +2393,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_3) // and group will cease to exist. The event should transition to "canceled", then be removed fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "canceled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "canceled"); } FC_LOG_AND_RETHROW() } @@ -2488,7 +2488,7 @@ BOOST_AUTO_TEST_CASE(event_driven_progression_errors_1) generate_blocks(1); fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "canceled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "canceled"); // we can't go back to upcoming, in_progress, frozen, or finished once we're canceled. // (this won't work because the event has been deleted) @@ -2540,7 +2540,7 @@ BOOST_AUTO_TEST_CASE(event_driven_progression_errors_2) // as soon as a block is generated, the betting market group will settle, and the market // and group will cease to exist. The event should transition to "settled", then removed fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); // we can't go back to upcoming, in_progress, frozen, or finished once we're canceled. // (this won't work because the event has been deleted) @@ -2612,7 +2612,7 @@ BOOST_AUTO_TEST_CASE(betting_market_group_driven_standard_progression) // as soon as a block is generated, the betting market group will settle, and the market // and group will cease to exist. The event should transition to "settled" fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); } FC_LOG_AND_RETHROW() } @@ -2723,7 +2723,7 @@ BOOST_AUTO_TEST_CASE(multi_betting_market_group_driven_standard_progression) // as soon as a block is generated, the two betting market groups will settle, and the market // and group will cease to exist. The event should transition to "settled" fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id}); - BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(), "settled"); + BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as(1), "settled"); } FC_LOG_AND_RETHROW() } @@ -2834,13 +2834,13 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_sf_test ) transfer(account_id_type(), alice_id, asset(10000000)); transfer(account_id_type(), bob_id, asset(10000000)); - BOOST_TEST_MESSAGE("moneyline_berdych_vs_federer " << fc::variant(moneyline_berdych_vs_federer.id).as()); - BOOST_TEST_MESSAGE("moneyline_cilic_vs_querrey " << fc::variant(moneyline_cilic_vs_querrey.id).as()); + BOOST_TEST_MESSAGE("moneyline_berdych_vs_federer " << fc::variant(moneyline_berdych_vs_federer.id, 1).as(1)); + BOOST_TEST_MESSAGE("moneyline_cilic_vs_querrey " << fc::variant(moneyline_cilic_vs_querrey.id, 1).as(1)); - BOOST_TEST_MESSAGE("berdych_wins_market " << fc::variant(berdych_wins_market.id).as()); - BOOST_TEST_MESSAGE("federer_wins_market " << fc::variant(federer_wins_market.id).as()); - BOOST_TEST_MESSAGE("cilic_wins_market " << fc::variant(cilic_wins_market.id).as()); - BOOST_TEST_MESSAGE("querrey_wins_market " << fc::variant(querrey_wins_market.id).as()); + BOOST_TEST_MESSAGE("berdych_wins_market " << fc::variant(berdych_wins_market.id, 1).as(1)); + BOOST_TEST_MESSAGE("federer_wins_market " << fc::variant(federer_wins_market.id, 1).as(1)); + BOOST_TEST_MESSAGE("cilic_wins_market " << fc::variant(cilic_wins_market.id, 1).as(1)); + BOOST_TEST_MESSAGE("querrey_wins_market " << fc::variant(querrey_wins_market.id, 1).as(1)); place_bet(alice_id, berdych_wins_market.id, bet_type::back, asset(1000000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION); place_bet(bob_id, berdych_wins_market.id, bet_type::lay, asset(1000000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION); @@ -2895,10 +2895,10 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_final_test ) transfer(account_id_type(), alice_id, asset(10000000)); transfer(account_id_type(), bob_id, asset(10000000)); - BOOST_TEST_MESSAGE("moneyline_cilic_vs_federer " << fc::variant(moneyline_cilic_vs_federer.id).as()); + BOOST_TEST_MESSAGE("moneyline_cilic_vs_federer " << fc::variant(moneyline_cilic_vs_federer.id, 1).as(1)); - BOOST_TEST_MESSAGE("federer_wins_final_market " << fc::variant(federer_wins_final_market.id).as()); - BOOST_TEST_MESSAGE("cilic_wins_final_market " << fc::variant(cilic_wins_final_market.id).as()); + BOOST_TEST_MESSAGE("federer_wins_final_market " << fc::variant(federer_wins_final_market.id, 1).as(1)); + BOOST_TEST_MESSAGE("cilic_wins_final_market " << fc::variant(cilic_wins_final_market.id, 1).as(1)); betting_market_group_id_type moneyline_cilic_vs_federer_id = moneyline_cilic_vs_federer.id; update_betting_market_group(moneyline_cilic_vs_federer_id, _status = betting_market_group_status::in_play); diff --git a/tests/tests/network_node_api_tests.cpp b/tests/tests/network_node_api_tests.cpp index b857cdfe..88b762ea 100644 --- a/tests/tests/network_node_api_tests.cpp +++ b/tests/tests/network_node_api_tests.cpp @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(subscribe_to_pending_transactions) { signed_transaction transaction_in_notification; network_node_api.subscribe_to_pending_transactions([&]( const variant& signed_transaction_object ){ - transaction_in_notification = signed_transaction_object.as(); + transaction_in_notification = signed_transaction_object.as( GRAPHENE_MAX_NESTED_OBJECTS ); }); auto sam_transaction = push_transaction_for_account_creation("sam");