From 5da656565a262df82993f674721b401b2464221d Mon Sep 17 00:00:00 2001 From: nsjames Date: Tue, 25 Jun 2024 12:22:49 +0100 Subject: [PATCH] use actual producer list to split rewards instead of configured max --- contracts/eosio.bpay/src/eosio.bpay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/eosio.bpay/src/eosio.bpay.cpp b/contracts/eosio.bpay/src/eosio.bpay.cpp index fee02ce1..42999b01 100644 --- a/contracts/eosio.bpay/src/eosio.bpay.cpp +++ b/contracts/eosio.bpay/src/eosio.bpay.cpp @@ -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>(); @@ -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 );