Commit 7827098a authored by Bartek Wrona's avatar Bartek Wrona
Browse files

effective_comment_vote_operation extended by total_vote_weight field.

parent 6cf2f52e
......@@ -1785,6 +1785,9 @@ void pre_hf20_vote_evaluator( const vote_operation& o, database& _db )
c.total_vote_weight += max_vote_weight;
});
}
vop.total_vote_weight = comment_cashout->total_vote_weight;
if( !_db.has_hardfork( HIVE_HARDFORK_0_17__774) )
_db.adjust_rshares2( old_rshares, new_rshares );
......@@ -1890,6 +1893,7 @@ void pre_hf20_vote_evaluator( const vote_operation& o, database& _db )
});
effective_comment_vote_operation vop(o.voter, o.author, o.permlink);
vop.total_vote_weight = comment_cashout->total_vote_weight;
_db.modify( *itr, [&]( comment_vote_object& cv )
{
......@@ -2180,9 +2184,6 @@ void hf20_vote_evaluator( const vote_operation& o, database& _db )
vop.weight = newVote.weight;
vop.rshares = newVote.rshares;
_db.push_virtual_operation(vop);
if( max_vote_weight ) // Optimization
{
_db.modify( *comment_cashout, [&]( comment_cashout_object& cc )
......@@ -2190,6 +2191,10 @@ void hf20_vote_evaluator( const vote_operation& o, database& _db )
cc.total_vote_weight += max_vote_weight;
});
}
vop.total_vote_weight = comment_cashout->total_vote_weight;
_db.push_virtual_operation(vop);
}
else
{
......@@ -2284,6 +2289,7 @@ void hf20_vote_evaluator( const vote_operation& o, database& _db )
});
effective_comment_vote_operation vop(o.voter, o.author, o.permlink);
vop.total_vote_weight = comment_cashout->total_vote_weight;
vop.weight = vote.weight;
vop.rshares = vote.rshares;
_db.push_virtual_operation(vop);
......
......@@ -163,6 +163,7 @@ namespace hive { namespace protocol {
string permlink;
uint64_t weight = 0; ///< defines the score this vote receives, used by vote payout calc. 0 if a negative vote or changed votes.
int64_t rshares = 0; ///< The number of rshares this vote is responsible for
uint64_t total_vote_weight = 0; ///< the total weight of voting rewards, used to calculate pro-rata share of curation payouts
//potential payout of related comment at the moment of this vote
asset pending_payout = asset( 0, HBD_SYMBOL ); //supplemented by account history RocksDB plugin (needed by HiveMind)
};
......@@ -291,7 +292,7 @@ FC_REFLECT( hive::protocol::fill_order_operation, (current_owner)(current_orderi
FC_REFLECT( hive::protocol::fill_transfer_from_savings_operation, (from)(to)(amount)(request_id)(memo) )
FC_REFLECT( hive::protocol::hardfork_operation, (hardfork_id) )
FC_REFLECT( hive::protocol::comment_payout_update_operation, (author)(permlink) )
FC_REFLECT( hive::protocol::effective_comment_vote_operation, (voter)(author)(permlink)(weight)(rshares)(pending_payout))
FC_REFLECT( hive::protocol::effective_comment_vote_operation, (voter)(author)(permlink)(weight)(rshares)(total_vote_weight)(pending_payout))
FC_REFLECT( hive::protocol::ineffective_delete_comment_operation, (author)(permlink))
FC_REFLECT( hive::protocol::return_vesting_delegation_operation, (account)(vesting_shares) )
FC_REFLECT( hive::protocol::comment_benefactor_reward_operation, (benefactor)(author)(permlink)(hbd_payout)(hive_payout)(vesting_payout) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment