Skip to content

Commit

Permalink
Merge pull request #153 from eosnetworkfoundation/bpay-fixes
Browse files Browse the repository at this point in the history
Use actual producer list to split rewards instead of configured max
  • Loading branch information
nsjames authored Jun 26, 2024
2 parents 179357b + 5da6565 commit 3ee26da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/eosio.bpay/src/eosio.bpay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ void bpay::on_transfer( const name from, const name to, const asset quantity, co
check( _global.exists(), "global state does not exist");
uint16_t producer_count = _global.get().last_producer_schedule_size;

asset reward = quantity / producer_count;

// get producer with the most votes
// using `by_votes` secondary index
auto idx = _producers.get_index<"prototalvote"_n>();
Expand All @@ -54,6 +52,8 @@ void bpay::on_transfer( const name from, const name to, const asset quantity, co
prod++;
}

asset reward = quantity / top_producers.size();

// distribute rewards to top producers
for (auto producer : top_producers) {
auto row = _rewards.find( producer.value );
Expand Down

0 comments on commit 3ee26da

Please sign in to comment.