Skip to content

Commit 6a6d4d8

Browse files
committed
Refactor self_stake_boost to use uint32_t type and adjust related logic in voting.cpp for consistency and clarity.
1 parent 58b5f97 commit 6a6d4d8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

contracts/eosio.system/include/eosio.system/eosio.system.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ namespace eosiosystem {
457457
eosio::asset reserved3;
458458

459459
// TELOS BEGIN
460-
eosio::binary_extension<bool> self_stake_boost = false;
460+
eosio::binary_extension<uint32_t> self_stake_boost = 0;
461461
// TELOS END
462462

463463
uint64_t primary_key()const { return owner.value; }

contracts/eosio.system/src/voting.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,11 @@ namespace eosiosystem {
408408

409409
// print("\n Voter : ", voter->last_stake, " = ", voter->last_vote_weight, " = ", proxy, " = ", producers.size(), " = ", totalStaked, " = ", new_vote_weight);
410410

411-
bool self_stake_boost;
412-
if (voter->self_stake_boost.has_value() && voter->self_stake_boost.value() == true) {
413-
self_stake_boost = true;
411+
uint32_t self_stake_boost;
412+
if (voter->self_stake_boost.has_value()) {
413+
self_stake_boost = voter->self_stake_boost.value();
414414
} else {
415-
self_stake_boost = false;
415+
self_stake_boost = 0;
416416
}
417417

418418
//Voter from second vote
@@ -437,8 +437,9 @@ namespace eosiosystem {
437437
auto& d = producer_deltas[p];
438438
d.first -= voter->last_vote_weight;
439439
d.second = false;
440-
if (self_stake_boost && p == voter_name) {
441-
d.first -= 10*voter->last_vote_weight;
440+
if (p == voter_name) {
441+
d.first -= self_stake_boost*voter->last_vote_weight;
442+
self_stake_boost = 0;
442443
}
443444
}
444445
}
@@ -464,10 +465,9 @@ namespace eosiosystem {
464465
d.first += new_vote_weight;
465466
d.second = true;
466467
if (p == voter_name) {
467-
if (!self_stake_boost) {
468-
self_stake_boost = true;
469-
}
470-
d.first += 10*new_vote_weight;
468+
// TODO: self stake boost multiplier should be retrieved from the votingconfig table
469+
self_stake_boost = 10;
470+
d.first += self_stake_boost*new_vote_weight;
471471
}
472472
}
473473
}

0 commit comments

Comments
 (0)