diff --git a/hive/indexer/blocks.py b/hive/indexer/blocks.py index 4c049d0c9aebd038648ce49a90311a24e360382c..a8abd44b972ae86c08e37680cfdba0b6f1a66daf 100644 --- a/hive/indexer/blocks.py +++ b/hive/indexer/blocks.py @@ -109,22 +109,11 @@ class Blocks: op_type = vop['type'] op_value = vop['value'] - if op_type == 'curation_reward_operation': - key = "{}/{}".format(op_value['comment_author'], op_value['comment_permlink']) - - if key not in comment_payout_ops: - comment_payout_ops[key] = { 'curation_reward_operation':None, 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } - - if comment_payout_ops[key][op_type] is None: - comment_payout_ops[key][op_type] = op_value - else: - comment_payout_ops[key][op_type]['reward']['amount'] = int( comment_payout_ops[key][op_type]['reward']['amount'] ) + int( op_value['reward']['amount'] ) - - elif op_type == 'author_reward_operation': + if op_type == 'author_reward_operation': key = "{}/{}".format(op_value['author'], op_value['permlink']) if key not in comment_payout_ops: - comment_payout_ops[key] = { 'curation_reward_operation':None, 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } + comment_payout_ops[key] = { 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } comment_payout_ops[key][op_type] = op_value @@ -132,7 +121,7 @@ class Blocks: key = "{}/{}".format(op_value['author'], op_value['permlink']) if key not in comment_payout_ops: - comment_payout_ops[key] = { 'curation_reward_operation':None, 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } + comment_payout_ops[key] = { 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } comment_payout_ops[key]['effective_comment_vote_operation'] = None @@ -144,7 +133,7 @@ class Blocks: key_vote = "{}/{}/{}".format(op_value['voter'], op_value['author'], op_value['permlink']) if key not in comment_payout_ops: - comment_payout_ops[key] = { 'curation_reward_operation':None, 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } + comment_payout_ops[key] = { 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } comment_payout_ops[key][op_type] = op_value @@ -155,7 +144,7 @@ class Blocks: key = "{}/{}".format(op_value['author'], op_value['permlink']) if key not in comment_payout_ops: - comment_payout_ops[key] = { 'curation_reward_operation':None, 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } + comment_payout_ops[key] = { 'author_reward_operation':None, 'comment_reward_operation':None, 'effective_comment_vote_operation':None, 'comment_payout_update_operation':None } comment_payout_ops[key][op_type] = op_value diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py index d3184e3e2f8b0ef9fb41caeb0fe1e24043f5ab6c..066ad72dd1fbd76a3c60a89c875cb31faf1721a5 100644 --- a/hive/indexer/posts.py +++ b/hive/indexer/posts.py @@ -207,7 +207,7 @@ class Posts: values = [] values_limit = 1000 - ops_stats = { 'curation_reward_operation' : 0, 'author_reward_operation' : 0, 'comment_reward_operation' : 0, 'effective_comment_vote_operation' : 0, 'comment_payout_update_operation' : 0 } + ops_stats = { 'author_reward_operation' : 0, 'comment_reward_operation' : 0, 'effective_comment_vote_operation' : 0, 'comment_payout_update_operation' : 0 } """ Process comment payment operations """ for k, v in ops.items(): @@ -222,7 +222,7 @@ class Posts: # total payout for comment comment_author_reward = None - curator_rewards = None + curators_vesting_payout = None total_payout_value = None; curator_payout_value = None; beneficiary_payout_value = None; @@ -236,20 +236,13 @@ class Posts: is_paidout = None - if v[ 'curation_reward_operation' ] is not None: - value = v[ 'curation_reward_operation' ] - ops_stats[ 'curation_reward_operation' ] += 1 - curator_rewards = value['reward'] - if author is None: - author = value['comment_author'] - permlink = value['comment_permlink'] - if v[ 'author_reward_operation' ] is not None: value = v[ 'author_reward_operation' ] ops_stats[ 'author_reward_operation' ] += 1 author_rewards_hive = value['hive_payout']['amount'] author_rewards_hbd = value['hbd_payout']['amount'] author_rewards_vests = value['vesting_payout']['amount'] + curators_vesting_payout = value['curators_vesting_payout']['amount'] if author is None: author = value['author'] permlink = value['permlink'] @@ -300,7 +293,7 @@ class Posts: author, permlink, "NULL" if ( total_payout_value is None ) else ( "'{}'".format( legacy_amount(total_payout_value) ) ), - "NULL" if ( curator_rewards is None ) else ( "'{}'".format( legacy_amount(curator_rewards) ) ), #curator_payout_value + "NULL" if ( curators_vesting_payout is None ) else ( "'{}'".format( legacy_amount(curators_vesting_payout) ) ), #curator_payout_value "NULL" if ( author_rewards is None ) else author_rewards, "NULL" if ( author_rewards_hive is None ) else author_rewards_hive, "NULL" if ( author_rewards_hbd is None ) else author_rewards_hbd, diff --git a/hive/indexer/votes.py b/hive/indexer/votes.py index e5e47947f08dd87f9554d9d444e7f15500343dcc..036ce1f3e08379ea8d188fc504669f25ac362551 100644 --- a/hive/indexer/votes.py +++ b/hive/indexer/votes.py @@ -98,17 +98,17 @@ class Votes: select data_source.post_id, data_source.voter_id, data_source.author_id, data_source.permlink_id, data_source.weight from ( - SELECT hp.id as post_id, ha_v.id as voter_id, ha_a.id as author_id, hpd_p.id as permlink_id, t.weight - from - ( - VALUES - -- voter, author, permlink, weight - {} - ) AS T(voter, author, permlink, weight) - INNER JOIN hive_accounts ha_v ON ha_v.name = t.voter - INNER JOIN hive_accounts ha_a ON ha_a.name = t.author - INNER JOIN hive_permlink_data hpd_p ON hpd_p.permlink = t.permlink - INNER JOIN hive_posts hp ON hp.author_id = ha_a.id AND hp.permlink_id = hpd_p.id + SELECT hp.id as post_id, ha_v.id as voter_id, ha_a.id as author_id, hpd_p.id as permlink_id, t.weight + from + ( + VALUES + -- voter, author, permlink, weight + {} + ) AS T(voter, author, permlink, weight) + INNER JOIN hive_accounts ha_v ON ha_v.name = T.voter + INNER JOIN hive_accounts ha_a ON ha_a.name = T.author + INNER JOIN hive_permlink_data hpd_p ON hpd_p.permlink = T.permlink + INNER JOIN hive_posts hp ON hp.author_id = ha_a.id AND hp.permlink_id = hpd_p.id ) as data_source(post_id, voter_id, author_id, permlink_id, weight) ON CONFLICT ON CONSTRAINT hive_votes_ux1 DO UPDATE diff --git a/hive/steem/client.py b/hive/steem/client.py index 2fbc597610df4c9627b556830033652c3335d6b6..4bf58c77109f21df0e93f6bb5b87491d119ff533 100644 --- a/hive/steem/client.py +++ b/hive/steem/client.py @@ -145,7 +145,7 @@ class SteemClient: def get_virtual_operations(self, block): """ Get virtual ops from block """ result = self.__exec('get_ops_in_block', {"block_num":block, "only_virtual":True}) - tracked_ops = ['curation_reward_operation', 'author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation', 'comment_payout_update_operation'] + tracked_ops = ['author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation', 'comment_payout_update_operation'] ret = [] result = result['ops'] if 'ops' in result else [] for vop in result: @@ -162,13 +162,12 @@ class SteemClient: #According to definition of hive::plugins::acount_history::enum_vops_filter: author_reward_operation = 0x000002 - curation_reward_operation = 0x000004 comment_reward_operation = 0x000008 effective_comment_vote_operation = 0x400000 comment_payout_update_operation = 0x000800 - tracked_ops_filter = curation_reward_operation | author_reward_operation | comment_reward_operation | effective_comment_vote_operation | comment_payout_update_operation - tracked_ops = ['curation_reward_operation', 'author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation', 'comment_payout_update_operation'] + tracked_ops_filter = author_reward_operation | comment_reward_operation | effective_comment_vote_operation | comment_payout_update_operation + tracked_ops = ['author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation', 'comment_payout_update_operation'] resume_on_operation = 0