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

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
NosoDevTeam committed Apr 23, 2024
1 parent 6705d0f commit 94e88cc
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 30 deletions.
21 changes: 17 additions & 4 deletions masterpaskalform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ TForm1 = class(TForm)
OficialRelease = true;
BetaRelease = false;
VersionRequired = '0.4.2';
BuildDate = 'March 2024';
BuildDate = 'April 2024';
{Developer addresses}
ADMINHash = 'N4PeJyqj8diSXnfhxSQdLpo8ddXTaGd';
AdminPubKey = 'BL17ZOMYGHMUIUpKQWM+3tXKbcXF0F+kd4QstrB0X7iWvWdOSrlJvTPLQufc1Rkxl6JpKKj/KSHpOEBK+6ukFK4=';
Expand Down Expand Up @@ -637,6 +637,7 @@ TForm1 = class(TForm)
WO_SendReport : boolean = false;
WO_StopGUI : boolean = false;
WO_BlockDB : boolean = false;
WO_PRestart : int64 = 0;
RPCFilter : boolean = true;
RPCWhitelist : string = '127.0.0.1,localhost';
RPCBanned : string = '';
Expand Down Expand Up @@ -1401,15 +1402,21 @@ constructor TThreadKeepConnect.Create(CreateSuspended : boolean);

procedure TThreadKeepConnect.Execute;
const
LastTrySlot : integer = 0;
LAstTryTime : int64 = 0;
Unables : integer = 0;
LastTrySlot : integer = 0;
LAstTryTime : int64 = 0;
Unables : integer = 0;
PRestartTime : int64 = 0;
var
TryThis : boolean = true;
Loops : integer = 0;
OutGoing : integer;
Begin
AddNewOpenThread('KeepConnect',UTCTime);
if WO_PRestart > 0 then
begin
PRestartTime := UTCTime + (WO_PRestart*600);
ToLog('Console','PRestart set at '+TimestampToDate(PRestartTime));
end;
while not terminated do
begin
UpdateOpenThread('KeepConnect',UTCTime);
Expand All @@ -1425,7 +1432,13 @@ procedure TThreadKeepConnect.Execute;
ConnectClient(NodesIndex(LastTrySlot).ip,NodesIndex(LastTrySlot).port);
end;
sleep(3000);
if PRestartTime > 0 then
begin
if ( (blockAge>120) and (blockAge<450) and (UTCTime>PRestartTime) ) then
ProcesslinesAdd('restart');
end;
end;
if EngineLastUpdate+10 < UTCTime then Parse_RestartNoso;
CloseOpenThread('KeepConnect');
End;

Expand Down
53 changes: 32 additions & 21 deletions mpdisk.pas
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,38 @@ implementation
GetGVTsFileData;
OutText('✓ GVTs file ok',false,1);

if not FileExists(CFGFilename) then
begin
SaveCFGToFile(DefaultNosoCFG);
SetCFGFilename('NOSODATA'+DirectorySeparator+CFGFilename);
{
if not FileExists(CFGFilename) then
begin
SaveCFGToFile(DefaultNosoCFG);
GetCFGFromFile;
Defseeds := GetRepoFile('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos');
if DefSeeds = '' then Defseeds := GetRepoFile('https://api.nosocoin.com/nodes/seed');
if defseeds <> '' then
begin
SetCFGData(Defseeds,1);
Tolog('console','Defaults seeds downloaded from trustable source');
end
else ToLog('console','Unable to download default seeds. Please, use a fallback');
end;
GetCFGFromFile;
Defseeds := GetRepoFile('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos');
if DefSeeds = '' then Defseeds := GetRepoFile('https://api.nosocoin.com/nodes/seed');
if defseeds <> '' then
}
OutText('✓ NosoCFG file ok',false,1);


if not SetWalletFilename('NOSODATA'+DirectorySeparator+'wallet.pkw') then S_AdvOpt := true;
{
if not FileExists (WalletFilename) then
begin
SetCFGData(Defseeds,1);
Tolog('console','Defaults seeds downloaded from trustable source');
CreateNewWallet;
S_AdvOpt := true;
end
else ToLog('console','Unable to download default seeds. Please, use a fallback');
end;
GetCFGFromFile;
OutText('✓ NosoCFG file ok',false,1);
else LoadWallet(WalletFilename);
}
OutText('✓ Wallet file ok',false,1);

if not FileExists (WalletFilename) then
begin
CreateNewWallet;
S_AdvOpt := true;
end
else LoadWallet(WalletFilename);
OutText('✓ Wallet file ok',false,1);

FillNodeList; // Fills the hardcoded seed nodes list
FillNodeList; // Fills the hardcoded seed nodes list

if not Fileexists(SummaryFileName) then CreateNewSummaryFile(FileExists(BlockDirectory+'0.blk'));
CreateSumaryIndex();
Expand Down Expand Up @@ -248,6 +255,8 @@ implementation
writeln(FileAdvOptions,'SendReport '+BoolToStr(WO_SendReport,true));
writeln(FileAdvOptions,'//Keep a blocks database');
writeln(FileAdvOptions,'BlocksDB '+BoolToStr(WO_BlockDB,true));
writeln(FileAdvOptions,'//Restart periodically the node');
writeln(FileAdvOptions,'PRestart '+IntToStr(WO_PRestart));

writeln(FileAdvOptions,'//Mainform coordinates. Do not manually change this values');
writeln(FileAdvOptions,Format('FormState %d %d %d %d %d',[Form1.Top,form1.Left,form1.Width,form1.Height,form1.WindowState]));
Expand Down Expand Up @@ -320,6 +329,8 @@ implementation
if parameter(linea,0) ='PosWarning' then WO_PosWarning:=StrToIntDef(Parameter(linea,1),WO_PosWarning);
if parameter(linea,0) ='SendReport' then WO_SendReport:=StrToBool(Parameter(linea,1));
if parameter(linea,0) ='BlocksDB' then WO_BlockDB:=StrToBool(Parameter(linea,1));
if parameter(linea,0) ='PRestart' then WO_PRestart:=StrToIntDef(Parameter(linea,1),0);


if parameter(linea,0) ='MultiSend' then WO_MultiSend:=StrToBool(Parameter(linea,1));
if parameter(linea,0) ='HideEmpty' then WO_HideEmpty:=StrToBool(Parameter(linea,1));
Expand Down
6 changes: 3 additions & 3 deletions mpparser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ function GetOpData(textLine:string):String;
else if UpperCase(Command) = 'NEWFROMKEYS' then NewAddressFromKeys(LineText)
else if UpperCase(Command) = 'TESTHASH' then TestHashGeneration(LineText)
else if UpperCase(Command) = 'COMPARE' then CompareHashes(LineText)
else if UpperCase(Command) = 'GETREPOSEEDS' then ToLog('console',GetRepoFile('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos'))
else if UpperCase(Command) = 'GETREPOSEEDS' then ToLog('console',SendApiRequest('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos'))
else if UpperCase(Command) = 'FORCEREPOSEEDS' then
begin
SetCFGData(GetRepoFile('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos'),1);
SetCFGData(SendApiRequest('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos'),1);
end
else if UpperCase(Command) = 'SENDREPORT' then SEndFileViaTCP(ResumeLogFilename,'REPORT','debuglogs.nosocoin.com:18081',18081)
else if UpperCase(Command) = 'GETDBLB' then ToLog('console',GetDBLastBlock.ToString)
Expand Down Expand Up @@ -802,7 +802,7 @@ function SendFunds(LineText:string;showOutput:boolean=true):string;
end;
Setlength(orderstring,length(orderstring)-2);
OrderString := StringReplace(OrderString,'PSK','NSLORDER',[]);
//ToLog('console','Send to Node '+OrderString);
ToLog('console','Send to Node '+OrderString);
result := SendOrderToNode(OrderString);
//ToLog('console','Node result: '+result);
OutgoingMsjsAdd(OrderString);
Expand Down
22 changes: 20 additions & 2 deletions nosonosocfg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface
Function IsSeedNode(IP:String):boolean;

var
CFGFilename : string= 'NOSODATA'+DirectorySeparator+'nosocfg.psk';
CFGFilename : string= 'nosocfg.psk';
CFGFile : Textfile;
MyCFGHash : string = '';
CS_CFGFile : TRTLCriticalSection;
Expand All @@ -40,7 +40,7 @@ interface
LasTimeCFGRequest : int64 = 0;
DefaultNosoCFG : String = // CFG parameters
{0 Mainnet mode}'NORMAL '+
{1 Seed nodes }'63.227.69.162;8080:20.199.50.27;8080:107.172.21.121;8080:107.172.214.53;8080:198.23.134.105;8080:107.173.210.55;8080:5.230.55.203;8080:141.11.192.215;8080:4.233.61.8;8080: '+
{1 Seed nodes }'20.199.50.27;8080:107.173.210.55;8080:5.230.55.203;8080:141.11.192.215;8080:4.233.61.8;8080:84.247.143.153;8080:23.95.216.80;8080:64.69.43.225;8080:142.171.231.9;8080: '+
{2 NTP servers }'ts2.aco.net:hora.roa.es:time.esa.int:time.stdtime.gov.tw:stratum-1.sjc02.svwh.net:ntp1.sp.se:1.de.pool.ntp.org:ntps1.pads.ufrj.br:utcnist2.colorado.edu:tick.usask.ca:ntp1.st.keio.ac.jp: '+
{3 DEPRECATED }'null: '+
{4 DEPRECATED }'null: '+
Expand Down Expand Up @@ -70,9 +70,27 @@ interface
{$REGION File access}

Procedure SetCFGFilename(Fname:String);
var
defseeds : string = '';
Begin
CFGFilename := Fname;
AssignFile(CFGFile, CFGFilename);
if not fileexists(CFGFilename) then
begin
SaveCFGToFile(DefaultNosoCFG);
GetCFGFromFile;
Defseeds := SendApiRequest('https://raw.githubusercontent.com/Noso-Project/NosoWallet/main/defseeds.nos');
if defseeds <> '' then
begin
SetCFGData(Defseeds,1);
Tolog('console','Defaults seeds downloaded from trustable source');
end
else
begin
ToLog('console','Unable to download default seeds. Please, use a fallback');
end;
end;
GetCFGFromFile;
SetCFGHash();
End;

Expand Down
16 changes: 16 additions & 0 deletions nosowallcon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface
LastOP : int64; // tiempo de la ultima operacion en UnixTime.
end;

Function SetWalletFileName(Fname:String):Boolean;
Procedure ClearWalletArray();
function InsertToWallArr(LData:WalletData):boolean;
Function GetWallArrIndex(Index:integer):WalletData;
Expand Down Expand Up @@ -55,6 +56,19 @@ function CreateNewWallet():Boolean;

IMPLEMENTATION

// Set the wallet filename; if not exists, returns false
Function SetWalletFileName(Fname:String):Boolean;
Begin
Result := true;
WalletFilename := Fname;//'NOSODATA'+DirectorySeparator+'wallet.pkw';
if not FileExists(WalletFilename) then
begin
CreateNewWallet;
result := false;
end
else LoadWallet(WalletFilename);
End;

Procedure ClearWalletArray();
Begin
EnterCriticalSection(CS_WalletArray);
Expand Down Expand Up @@ -173,6 +187,7 @@ function InsertToWallArr(LData:WalletData):boolean;
ThisData : WalletData;
Begin
Result := 0;
BeginPerformance('ImportAddressesFromBackup');
BakFiles := TStringList.Create;
TRY
FindAllFiles(BakFiles, BakFolder, '*.pkw', true);
Expand All @@ -191,6 +206,7 @@ function InsertToWallArr(LData:WalletData):boolean;
end;
END;
BakFiles.free;
EndPerformance('ImportAddressesFromBackup');
End;

// Saves an address info to a specific file
Expand Down

0 comments on commit 94e88cc

Please sign in to comment.