Fix get_full_accounts and SON object serialization

This commit is contained in:
serkixenos 2021-01-26 16:01:26 +00:00 committed by Bobinson K B
parent 317093930f
commit 057db52d1e
7 changed files with 31 additions and 9 deletions

View file

@ -12,7 +12,7 @@ stages:
build: build:
stage: build stage: build
script: script:
- rm -rf .git/modules/* ./docs ./libraries/fc - rm -rf .git/modules/docs .git/modules/libraries/fc ./docs ./libraries/fc
- git submodule sync - git submodule sync
- git submodule update --init --recursive - git submodule update --init --recursive
- rm -rf build - rm -rf build

View file

@ -2086,7 +2086,7 @@ vector<variant> database_api_impl::lookup_vote_ids( const vector<vote_id_type>&
{ {
auto itr = son_idx.find( id ); auto itr = son_idx.find( id );
if( itr != son_idx.end() ) if( itr != son_idx.end() )
result.emplace_back( variant( *itr, 1 ) ); result.emplace_back( variant( *itr, 5 ) );
else else
result.emplace_back( variant() ); result.emplace_back( variant() );
break; break;

View file

@ -70,6 +70,5 @@ FC_REFLECT( graphene::app::full_account,
(proposals) (proposals)
(assets) (assets)
(withdraws) (withdraws)
(proposals)
(pending_dividend_payments) (pending_dividend_payments)
) )

View file

@ -115,7 +115,17 @@ namespace graphene { namespace chain {
FC_REFLECT_ENUM(graphene::chain::son_status, (inactive)(active)(request_maintenance)(in_maintenance)(deregistered) ) FC_REFLECT_ENUM(graphene::chain::son_status, (inactive)(active)(request_maintenance)(in_maintenance)(deregistered) )
FC_REFLECT_DERIVED( graphene::chain::son_object, (graphene::db::object), FC_REFLECT_DERIVED( graphene::chain::son_object, (graphene::db::object),
(son_account)(vote_id)(total_votes)(url)(deposit)(signing_key)(pay_vb)(statistics)(status)(sidechain_public_keys) ) (son_account)
(vote_id)
(total_votes)
(url)
(deposit)
(signing_key)
(pay_vb)
(statistics)
(status)
(sidechain_public_keys)
)
FC_REFLECT_DERIVED( graphene::chain::son_statistics_object, FC_REFLECT_DERIVED( graphene::chain::son_statistics_object,
(graphene::db::object), (graphene::db::object),
@ -131,3 +141,6 @@ FC_REFLECT_DERIVED( graphene::chain::son_statistics_object,
(total_sidechain_txs_reported) (total_sidechain_txs_reported)
(sidechain_txs_reported) (sidechain_txs_reported)
) )
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::chain::son_object )
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::chain::son_statistics_object )

View file

@ -35,6 +35,7 @@
#include <graphene/chain/global_property_object.hpp> #include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/market_object.hpp> #include <graphene/chain/market_object.hpp>
#include <graphene/chain/operation_history_object.hpp> #include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/son_object.hpp>
#include <graphene/chain/special_authority_object.hpp> #include <graphene/chain/special_authority_object.hpp>
#include <graphene/chain/transaction_object.hpp> #include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp> #include <graphene/chain/withdraw_permission_object.hpp>
@ -62,6 +63,8 @@ GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::dynamic_global
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::global_property_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::global_property_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::operation_history_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::operation_history_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::account_transaction_history_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::account_transaction_history_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::son_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::son_statistics_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::special_authority_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::special_authority_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_object )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::withdraw_permission_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::withdraw_permission_object )

View file

@ -3015,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() + 15; GRAPHENE_TESTING_GENESIS_TIMESTAMP =
(HARDFORK_1000_TIME.sec_since_epoch() + 15) / GRAPHENE_DEFAULT_BLOCK_INTERVAL * GRAPHENE_DEFAULT_BLOCK_INTERVAL;
return nullptr; return nullptr;
} }

View file

@ -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(HARDFORK_GPOS_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes 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);
@ -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(HARDFORK_GPOS_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes 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);