Skip to content

Commit

Permalink
Add voter vesting shares to operation dump #1
Browse files Browse the repository at this point in the history
  • Loading branch information
soft-bagel-93 committed Oct 8, 2019
1 parent 88eb0e9 commit ab8e005
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class operation_dump_plugin final : public appbase::plugin<operation_dump_plugin

dump_buffers buffers;
clarifications<int64_t> vote_rshares;
clarifications<asset> vote_effective_vs;
clarifications<bool> not_deleted_comments;
clarifications<asset> transfer_golos_amounts;
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class operation_dump_visitor {

fc::raw::pack(b, op);
fc::raw::pack(b, pop_clarification(_plugin.vote_rshares));
fc::raw::pack(b, pop_clarification(_plugin.vote_effective_vs));
fc::raw::pack(b, _block.timestamp);
}

Expand Down
5 changes: 4 additions & 1 deletion plugins/operation_dump/operation_dump_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ struct post_operation_clarifier {

result_type operator()(const vote_operation& op) const {
const auto& comment = _db.get_comment(op.author, op.permlink);
const auto& voter = _db.get_account(op.voter);
const auto& vote_idx = _db.get_index<comment_vote_index, by_comment_voter>();
auto vote_itr = vote_idx.find(std::make_tuple(comment.id, _db.get_account(op.voter).id));
auto vote_itr = vote_idx.find(std::make_tuple(comment.id, voter.id));

add_clarification(_plugin.vote_rshares, vote_itr->rshares);
add_clarification(_plugin.vote_effective_vs, voter->effective_vesting_shares());
}

result_type operator()(const delete_comment_operation& op) const {
Expand Down Expand Up @@ -67,6 +69,7 @@ class operation_dump_plugin::operation_dump_plugin_impl final {
void erase_block(uint32_t block_num) {
virtual_ops.erase(block_num);
_plugin.vote_rshares.erase(block_num);
_plugin.vote_effective_vs.erase(block_num);
_plugin.not_deleted_comments.erase(block_num);
_plugin.transfer_golos_amounts.erase(block_num);
}
Expand Down

0 comments on commit ab8e005

Please sign in to comment.