Skip to content

Commit

Permalink
Play with sampler sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Jun 29, 2022
1 parent 345586e commit 544b6bc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ protected override Sampler GetSampler(IEnumerable<(int id, long stake)> selectio
return base.GetSampler(selection, false);

var sorted = selection.OrderByDescending(x =>
Base58.Parse(Cache.Accounts.GetDelegate(x.id).Address), new BytesComparer());
{
var baker = Cache.Accounts.GetDelegate(x.id);
return new byte[] { (byte)baker.PublicKey[0] }.Concat(Base58.Parse(baker.Address));
}, new BytesComparer());

return new Sampler(sorted.Select(x => x.id).ToArray(), sorted.Select(x => x.stake).ToArray());
}
Expand Down

0 comments on commit 544b6bc

Please sign in to comment.