Browse Source

Reward decrease fix

In testnet detected that reward decrease was 1 block prior of expected.
Corrected for production
PascalCoin 7 years ago
parent
commit
d4db196639
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/core/UAccounts.pas

+ 6 - 1
src/core/UAccounts.pas

@@ -766,7 +766,12 @@ end;
 class function TPascalCoinProtocol.GetRewardForNewLine(line_index: Cardinal): UInt64;
 Var n, i : Cardinal;
 begin
-  n := (line_index + 1) DIV CT_NewLineRewardDecrease;
+  {$IFDEF TESTNET}
+  // TESTNET used (line_index +1), but PRODUCTION must use (line_index)
+  n := (line_index + 1) DIV CT_NewLineRewardDecrease;  // XXXXXXXXXXXXXXX TESTNET BAD USE (line_index + 1)
+  {$ELSE}
+  n := line_index DIV CT_NewLineRewardDecrease; // FOR PRODUCTION
+  {$ENDIF}
   Result := CT_FirstReward;
   for i := 1 to n do begin
     Result := Result DIV 2;