Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Commit

Permalink
038
Browse files Browse the repository at this point in the history
  • Loading branch information
DevTeamNoso committed May 10, 2023
1 parent d69c023 commit fe4e2f2
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lastrelease.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.7Aa1 {win64hash} {linux64hash} {signature}
0.3.8Aa1 {win64hash} {linux64hash} {signature}
11 changes: 6 additions & 5 deletions masterpaskalform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ TForm1 = class(TForm)
{4}'nosofish.xyz;8082:nosopool.estripa.online;8082:pool.nosomn.com;8082:159.196.1.198;8082: '+
{5}'NpryectdevepmentfundsGE:';

ProgramVersion = '0.3.7';
ProgramVersion = '0.3.8';
{$IFDEF WINDOWS}
RestartFileName = 'launcher.bat';
updateextension = 'zip';
Expand All @@ -622,7 +622,7 @@ TForm1 = class(TForm)
{$ENDIF}
SubVersion = 'Aa1';
OficialRelease = false;
VersionRequired = '0.3.3Aa6';
VersionRequired = '0.3.8Aa1';
BuildDate = 'May 2023';
{Developer addresses}
ADMINHash = 'N4PeJyqj8diSXnfhxSQdLpo8ddXTaGd';
Expand All @@ -644,7 +644,8 @@ TForm1 = class(TForm)
CoinSimbol = 'NOSO'; // Coin symbol
CoinName = 'Noso'; // Coin name
CoinChar = 'N'; // Char for addresses
MinimunFee = 10; // Minimun fee for transfer
MinimunFee = 10;
NewMinFee = 1000000; // Minimun fee for transfer
ComisionBlockCheck = 0; // +- 90 days
DeadAddressFee = 0; // unactive acount fee
ComisionScrow = 200; // Coin/BTC market comision = 0.5%
Expand Down Expand Up @@ -1087,10 +1088,10 @@ procedure TThreadClientRead.Execute;
if Downloaded and SavedToFile then
begin
AddLineToDebugLog('console',format(rs0087,[copy(HashMD5File(SummaryFileName),1,5)])); //'Sumary file received'
UpdateMyData();
CreateSumaryIndex();
UpdateWalletFromSumario;
LastTimeRequestSumary := 0;
UpdateMyData();
end;
MemStream.Free;
DownloadSumary := false;
Expand Down Expand Up @@ -3026,7 +3027,7 @@ procedure TForm1.IdTCPServer1Exception(AContext: TIdContext;AException: Exceptio
Begin
if Form1.Server.Active then Form1.StaSerImg.Visible:=true
else Form1.StaSerImg.Visible:=false;
Form1.StaConLab.Caption:=IntToStr(GetTotalVerifiedConnections);
Form1.StaConLab.Caption:=IntToStr(GetTotalSyncedConnections);
if MyConStatus = 0 then Form1.StaConLab.Color:= clred;
if MyConStatus = 1 then Form1.StaConLab.Color:= clyellow;
if MyConStatus = 2 then Form1.StaConLab.Color:= claqua;
Expand Down
9 changes: 7 additions & 2 deletions mpblock.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface

uses
Classes, SysUtils,MasterPaskalForm, fileutil, mpcoin, dialogs, math,
nosotime, mpMN, nosodebug,nosogeneral,nosocrypto, nosounit;
nosotime, mpMN, nosodebug,nosogeneral,nosocrypto, nosounit, strutils;

Procedure CrearBloqueCero();
Procedure BuildNewBlock(Numero,TimeStamp: Int64; TargetHash, Minero, Solucion:String);
Expand Down Expand Up @@ -120,7 +120,12 @@ implementation


Begin
if GetNosoCFGString(0) = 'STOP' then exit;
if GetNosoCFGString(0) = 'STOP' then
begin
ClearAllPending;
exit;
end;
if AnsiContainsStr(GetNosoCFGString(0),'EMPTY') then ClearAllPending;
BuildingBlock := Numero;
BeginPerformance('BuildNewBlock');
if ((numero>0) and (Timestamp < lastblockdata.TimeEnd)) then
Expand Down
6 changes: 3 additions & 3 deletions mpcoin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function AliasAlreadyExists(Addalias:string):boolean;
function GetFee(monto:int64):Int64;
Begin
Result := monto div Comisiontrfr;
if result < MinimunFee then result := MinimunFee;
if result < MinimunFee then result := 1000000;//MinimunFee;
End;

// Obtiene una orden de envio de fondos desde una direccion
Expand Down Expand Up @@ -348,14 +348,14 @@ function GetMaximunToSend(monto:int64):int64;
Diferencia : int64;
Begin
Disponible := monto;
if ( (disponible < MinimunFee) or (Disponible<0) ) then
if ( (disponible < 1000000{MinimunFee}) or (Disponible<0) ) then
begin
result := 0;
exit;
end;
maximo := (Disponible * Comisiontrfr) div (Comisiontrfr+1);
comision := maximo div Comisiontrfr;
if Comision < MinimunFee then Comision := MinimunFee;
if Comision < 1000000{MinimunFee} then Comision := 1000000{MinimunFee};
Envio := maximo + comision;
Diferencia := Disponible-envio;
result := maximo+diferencia;
Expand Down
5 changes: 3 additions & 2 deletions mpdisk.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface
Classes, SysUtils, MasterPaskalForm, Dialogs, Forms, nosotime, FileUtil, LCLType,
lclintf, controls, mpBlock, Zipper, mpcoin, mpMn, nosodebug,
{$IFDEF WINDOWS}Win32Proc, {$ENDIF}
translation, strutils,nosogeneral, nosocrypto, nosounit;
translation, strutils,nosogeneral, nosocrypto, nosounit, nosoconsensus;

Procedure VerificarArchivos();

Expand Down Expand Up @@ -970,6 +970,7 @@ function UnZipUpdateFromRepo(Tver,TArch:String):boolean;
StartBlock, finishblock : integer;
counter : integer;
Begin
if copy(MySumarioHash,0,5) = GetConsensus(17) then exit;
RebuildingSumary := true;
StartBlock := SummaryLastop+1;
finishblock := Mylastblock;
Expand All @@ -988,7 +989,7 @@ function UnZipUpdateFromRepo(Tver,TArch:String):boolean;
RebuildingSumary := false;
UpdateMyData();
ZipSumary;
AddLineToDebugLog('console','Sumary completed from '+IntToStr(StartBlock)+' to '+IntToStr(finishblock));
AddLineToDebugLog('console',format('Summary completed from %d to %d (%s)',[StartBlock-1,finishblock,Copy(MySumarioHash,0,5)]));
info('Sumary completed');
End;

Expand Down
7 changes: 5 additions & 2 deletions mpparser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1504,8 +1504,8 @@ function AvailableUpdates():string;
monto := StrToInt64Def(Parameter(LineText,1),0);
gmts := GetMaximunToSend(monto);
fee := monto-gmts;
if fee<MinimunFee then fee := MinimunFee;
if monto <= MinimunFee then
if fee<1000000{MinimunFee} then fee := 1000000{MinimunFee};
if monto <= 1000000{MinimunFee} then
begin
gmts := 0;
fee := 0;
Expand Down Expand Up @@ -1752,13 +1752,15 @@ function ShowPrivKey(linea:String;ToConsole:boolean = false):String;
AsExpected : string = '';
NegativeCount : integer = 0;
EmptyCount : integer = 0;
LastRecord : integer = -1;
Begin
AssignFile(SumFile,SummaryFileName);
TRY
Reset(SumFile,1);
While not eof(SumFile) do
begin
blockread(sumfile,ThisRecord,sizeof(ThisRecord));
if lastrecord < 0 then LastRecord := ThisRecord.LastOP;
if thisrecord.Balance<0 then Inc(NegativeCount);
if thisrecord.Balance=0 then Inc(EmptyCount);
inc(TotalCoins,ThisRecord.Balance);
Expand All @@ -1769,6 +1771,7 @@ function ShowPrivKey(linea:String;ToConsole:boolean = false):String;
END;{Try}
if TotalCoins = GetSupply(MyLastBlock) then AsExpected := ''
else AsExpected := '('+Int2curr(TotalCoins-GetSupply(MyLastBlock))+')';
AddLineToDebugLog('console',format('Block : %d',[LastRecord]));
AddLineToDebugLog('console',Int2Curr(Totalcoins)+' '+CoinSimbol+' '+AsExpected);
AddLineToDebugLog('console',format('Addresses (%d): %d (%d empty)',[NegativeCount,currpos,EmptyCount]));
End;
Expand Down
2 changes: 2 additions & 0 deletions mpprotocol.pas
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ function ValidateTrfr(order:Torderdata;Origen:String):integer;
result := 10
else if IsAddressLocked(Order.Address) then
result := 11
else if ( (AnsiContainsStr(GetNosoCFGString(0),'EMPTY')) or (AnsiContainsStr(GetNosoCFGString(0),'STOP')) ) then
result := 11
else result := 0;
End;

Expand Down
22 changes: 16 additions & 6 deletions mpred.pas
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function ReserveSlot():integer;
function ConnectClient(Address,Port:String):integer;
function GetTotalConexiones():integer;
function GetTotalVerifiedConnections():Integer;
function GetTotalSyncedConnections():Integer;
function CerrarClientes(ServerToo:Boolean=True):string;
Procedure LeerLineasDeClientes();
Procedure VerifyConnectionStatus();
Expand Down Expand Up @@ -295,10 +296,9 @@ function StopServer():boolean;
EndPerformance('CerrarSlot');
End;

// Intenta conectar a los nodos
// Try connection to nodes
Procedure ConnectToServers();
var
//contador : integer = 0;
proceder : boolean = true;
Success : boolean = false;
Intentos : integer = 0;
Expand All @@ -312,9 +312,9 @@ function StopServer():boolean;
AddLineToDebugLog('events',TimeToStr(now)+'Trying connection to servers'); //'Trying connection to servers'
CONNECT_Try := true;
end;
if OutGoing >= MaxOutgoingConnections then proceder := false;
//if OutGoing >= MaxOutgoingConnections then proceder := false;
if getTotalConexiones >= MaxConecciones then Proceder := false;
if GetSeedConnections>=3 then proceder := false;
if GetTotalSyncedConnections>=3 then proceder := false;
if proceder then
begin
rannumber := random(length(ListaNodos));
Expand Down Expand Up @@ -525,6 +525,15 @@ function GetTotalVerifiedConnections():Integer;
if conexiones[Counter].Autentic then result := result + 1;
End;

function GetTotalSyncedConnections():Integer;
var
counter:integer;
Begin
result := 0;
for counter := 1 to MaxConecciones do
if conexiones[Counter].MerkleHash = GetCOnsensus(0) then result := result + 1;
End;

// Close all outgoing connections
function CerrarClientes(ServerToo:Boolean=True):string;
var
Expand Down Expand Up @@ -1061,6 +1070,7 @@ function UpdateNetworkCFGHash():NetworkData;
begin
if GetValidSlotForSeed(ValidSlot) then
begin
AddLineToDebugLog('console',format('%s <> %s',[copy(MySumarioHash,0,5),GetConsensus(17)]));
PTC_SendLine(ValidSlot,ProtocolLine(6)); // Getsumary
AddLineToDebugLog('console',rs2003); //'sumary file requested'
LastTimeRequestsumary := UTCTime;
Expand Down Expand Up @@ -1095,7 +1105,7 @@ function UpdateNetworkCFGHash():NetworkData;
LeaveCriticalSection(CSMNsIPCheck);
PTC_SendLine(ValidSlot,ProtocolLine(11)); // Get MNsList
LastTimeMNsRequested := UTCTime;
AddLineToDebugLog('console','MNs reports requested');
//AddLineToDebugLog('console','MNs reports requested');
end;
end
else if ((StrToIntDef(GetConsensus(14),0)>GetMNsChecksCount) and (LastTimeChecksRequested+5<UTCTime)) then
Expand All @@ -1104,7 +1114,7 @@ function UpdateNetworkCFGHash():NetworkData;
begin
PTC_SendLine(ValidSlot,ProtocolLine(GetChecks)); // Get MNsChecks
LastTimeChecksRequested := UTCTime;
AddLineToDebugLog('console','Checks requested to '+conexiones[ValidSlot].ip);
//AddLineToDebugLog('console','Checks requested to '+conexiones[ValidSlot].ip);
end;
end
else if ( (GetConsensus(8)<>Copy(MyMNsHash,1,5)) and (LastTimeMNHashRequestes+5<UTCTime) and
Expand Down
5 changes: 3 additions & 2 deletions mprpc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface

uses
Classes, SysUtils, mpgui, FPJSON, jsonparser, mpCoin, mpRed, mpBlock,nosodebug,
nosogeneral, nosocrypto, nosounit;
nosogeneral, nosocrypto, nosounit, nosoconsensus;

Procedure SetRPCPort(LineText:string);
Procedure setRPCpassword(newpassword:string);
Expand Down Expand Up @@ -534,7 +534,8 @@ function RPC_Mininginfo(NosoPParams:string):string;
function RPC_Mainnetinfo(NosoPParams:string):string;
Begin
result := format('mainnetinfo'#127'%s'#127'%s'#127'%s'#127'%s'#127'%s'#127'%d',
[NetLastBlock.Value,NetLastBlockHash.Value,NetResumenHash.Value,NetSumarioHash.Value,NetPendingTrxs.Value,GetSupply(StrToIntDef(NetLastBlock.Value,0))]);
[GetConsensus(2),Copy(GetConsensus(10),0,5),copy(GetConsensus(15),0,5),copy(GetConsensus(17),0,5),
GetConsensus(3),GetSupply(StrToIntDef(GetConsensus(2),0))]);
End;

function RPC_PendingOrders(NosoPParams:string):string;
Expand Down
8 changes: 4 additions & 4 deletions nosogeneral.pas
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function TryDeleteFile(filename:string):boolean;
result := 2000{MNsPercentage} + (((block-48010{MNBlockStart}) div 4000) * 100);
if block >= 88400{PoSBlockEnd} then Inc(Result,1000);
if result > 6000 then result := 6000;
if MainnetMode = 'MNSONLY' then result := 9000;
if AnsiContainsStr(MainnetMode,'MNSONLY') then result := 9000;
end;
End;

Expand Down Expand Up @@ -225,7 +225,7 @@ function TryDeleteFile(filename:string):boolean;
Function GetMinimumFee(amount:int64):Int64;
Begin
Result := amount div 10000{Comisiontrfr};
if result < 10{MinimunFee} then result := 10{MinimunFee};
if result < 1000000{MinimunFee} then result := 1000000{MinimunFee};
End;

{Returns the maximum that can be sent from the specified amount}
Expand All @@ -236,11 +236,11 @@ function TryDeleteFile(filename:string):boolean;
Envio : int64;
Diferencia : int64;
Begin
if amount < 10{MinimunFee} then
if amount < 1000000{MinimunFee} then
exit(0);
maximo := (amount * 10000{Comisiontrfr}) div (10000{Comisiontrfr}+1);
comision := maximo div 10000{Comisiontrfr};
if Comision < 10{MinimunFee} then Comision := 10{MinimunFee};
if Comision < 1000000{MinimunFee} then Comision := 1000000{MinimunFee};
Envio := maximo + comision;
Diferencia := amount-envio;
result := maximo+diferencia;
Expand Down

0 comments on commit fe4e2f2

Please sign in to comment.