Mag unit also (wrongly) depends on the total magnitude in superblock. I think the rest of the function is not right as well.
//7-12-2015 - Calculate GRCMagnitudeUnit (Amount paid per magnitude per day)
StructCPID network = GetInitializedStructCPID2("NETWORK",mvNetwork);
double TotalNetworkMagnitude = network.NetworkMagnitude;
if (TotalNetworkMagnitude < 1000) TotalNetworkMagnitude=1000;
double MaximumEmission = BLOCKS_PER_DAY*GetMaximumBoincSubsidy(locktime);
double Kitty = MaximumEmission - (network.payments/14);
if (Kitty < 1) Kitty = 1;
double MagnitudeUnit = 0;
if (AreBinarySuperblocksEnabled(nBestHeight))
{
MagnitudeUnit = (Kitty/TotalNetworkMagnitude)*1.25;
}
else
{
MagnitudeUnit = Kitty/TotalNetworkMagnitude;
}
if (MagnitudeUnit > 5) MagnitudeUnit = 5; //Just in case we lose a superblock or something strange happens.
MagnitudeUnit = SnapToGrid(MagnitudeUnit); //Snaps the value into .025 increments
return MagnitudeUnit;