Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rshares to votes in EE genesis #625 #631

Merged
merged 2 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion programs/create-genesis-ee/event_engine_genesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ static abi_def create_messages_abi() {
"vote_info", "", {
{"voter", "name"},
{"weight", "int16"},
{"time", "time_point_sec"}
{"time", "time_point_sec"},
{"rshares", "int64"}
}
});

Expand Down
3 changes: 2 additions & 1 deletion programs/create-genesis-ee/event_engine_genesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct vote_info {
name voter;
int16_t weight;
fc::time_point_sec time;
int64_t rshares;
};

struct reblog_info {
Expand Down Expand Up @@ -83,7 +84,7 @@ struct block_info {

} } // cyberway::genesis

FC_REFLECT(cyberway::genesis::vote_info, (voter)(weight)(time))
FC_REFLECT(cyberway::genesis::vote_info, (voter)(weight)(time)(rshares))
FC_REFLECT(cyberway::genesis::reblog_info, (account)(title)(body)(time))
FC_REFLECT(cyberway::genesis::comment_info, (parent_author)(parent_permlink)(author)(permlink)(title)(body)
(tags)(language)(net_rshares)(author_reward)(benefactor_reward)(curator_reward)(votes)(reblogs))
Expand Down
7 changes: 7 additions & 0 deletions programs/create-genesis-ee/genesis_ee_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void genesis_ee_builder::process_votes() {
maps_.modify(*vote_itr, [&](auto& vote) {
vote.op_num = op.num;
vote.weight = vop.weight;
vote.rshares = vop.rshares;
vote.timestamp = vop.timestamp;
});
continue;
Expand All @@ -166,6 +167,7 @@ void genesis_ee_builder::process_votes() {
vote.voter = vop.voter;
vote.op_num = op.num;
vote.weight = vop.weight;
vote.rshares = vop.rshares;
vote.timestamp = vop.timestamp;
});
}
Expand Down Expand Up @@ -305,7 +307,12 @@ void genesis_ee_builder::build_votes(std::vector<vote_info>& votes, uint64_t msg
v.voter = generate_name(vote_itr->voter);
v.weight = vote_itr->weight;
v.time = vote_itr->timestamp;
v.rshares = vote_itr->rshares;
}, 0);

std::sort(votes.begin(), votes.end(), [&](const auto& a, const auto& b) {
return a.rshares > b.rshares;
});
}
}

Expand Down
3 changes: 2 additions & 1 deletion programs/create-genesis-ee/golos_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct vote_operation {
account_name_type author;
string permlink;
int16_t weight = 0;
int64_t rshares;
fc::time_point_sec timestamp;
};

Expand Down Expand Up @@ -102,7 +103,7 @@ struct total_comment_reward_operation {
} } // cyberway::golos

FC_REFLECT(cyberway::golos::comment_operation, (parent_author)(parent_permlink)(author)(permlink)(title)(body)(tags)(language))
FC_REFLECT(cyberway::golos::vote_operation, (voter)(author)(permlink)(weight)(timestamp))
FC_REFLECT(cyberway::golos::vote_operation, (voter)(author)(permlink)(weight)(rshares)(timestamp))
FC_REFLECT(cyberway::golos::reblog_operation, (account)(author)(permlink)(title)(body)(timestamp))
FC_REFLECT(cyberway::golos::delete_reblog_operation, (account))
FC_REFLECT(cyberway::golos::transfer_operation, (from)(to)(amount)(memo))
Expand Down
1 change: 1 addition & 0 deletions programs/create-genesis-ee/map_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct vote_header : public chainbase::object<vote_header_object_type, vote_head
operation_number op_num;
int16_t weight = 0;
fc::time_point_sec timestamp;
int64_t rshares;
};

struct reblog_header : public chainbase::object<reblog_header_object_type, reblog_header> {
Expand Down