From 8929e44361564be8a2bfa7bcc8b7433bf2a6da1d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Wed, 15 Jul 2020 04:03:15 +0900 Subject: [PATCH] Add a comment for commission_split() --- programs/vote/src/vote_state/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/vote/src/vote_state/mod.rs b/programs/vote/src/vote_state/mod.rs index 8673534eb6..383c71b001 100644 --- a/programs/vote/src/vote_state/mod.rs +++ b/programs/vote/src/vote_state/mod.rs @@ -259,6 +259,11 @@ impl VoteState { 100 => (on, 0, false), split => { let on = u128::from(on); + // Calculate mine and theirs independently and symmetrically instead of + // using the remainder of the other to treat them strictly equally. + // This is also to cancel the rewarding if either of the parties + // should receive only fractional lamports, resulting in not being rewarded at all. + // Thus, note that we intentionally discard any residual fractional lamports. let mine = on * u128::from(split) / 100u128; let theirs = on * u128::from(100 - split) / 100u128;