Skip to content

Commit

Permalink
ca6
Browse files Browse the repository at this point in the history
  • Loading branch information
NosoDevTeam committed Feb 8, 2024
1 parent aa119d3 commit 62cabf0
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 62 deletions.
7 changes: 6 additions & 1 deletion Noso.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="25">
<Units Count="26">
<Unit0>
<Filename Value="Noso.lpr"/>
<IsPartOfProject Value="True"/>
Expand Down Expand Up @@ -318,6 +318,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="NosoNosoCFG"/>
</Unit24>
<Unit25>
<Filename Value="nosoblock.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="NosoBlock"/>
</Unit25>
</Units>
</ProjectOptions>
<CompilerOptions>
Expand Down
2 changes: 1 addition & 1 deletion Noso.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Forms, MasterPaskalForm, mpGUI, mpdisk, mpParser, mpRed, mpProtocol, mpBlock,
mpCoin, mpsignerutils, mpRPC, translation, indylaz, sysutils, LCLTranslator,
mpMN, mpsyscheck, NosoTime, nosodebug, nosogeneral, nosocrypto, nosounit,
nosoconsensus, nosopsos, nosowallcon, NosoHeaders, NosoNosoCFG;
nosoconsensus, nosopsos, nosowallcon, NosoHeaders, NosoNosoCFG, NosoBlock;

{$R *.res}
var
Expand Down
2 changes: 1 addition & 1 deletion lastrelease.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.2Ca4 0.4.2Ca5 x {LastOfficial} {LastBeta} {TestNet}
0.4.2Ca4 0.4.2Ca6 x {LastOfficial} {LastBeta} {TestNet}
4 changes: 2 additions & 2 deletions masterpaskalform.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ object Form1: TForm1
Height = 460
Top = 0
Width = 632
ActivePage = TabNodeOptions
ActivePage = Tab_Options_RPC
Align = alClient
TabIndex = 1
TabIndex = 2
TabOrder = 0
object TabOpt_Wallet: TTabSheet
Caption = 'Wallet'
Expand Down
61 changes: 16 additions & 45 deletions masterpaskalform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface
strutils, math, IdHTTPServer, IdCustomHTTPServer,
IdHTTP, fpJSON, Types, DefaultTranslator, LCLTranslator, translation, nosodebug,
IdComponent,nosogeneral,nosocrypto, nosounit, nosoconsensus, nosopsos, NosoWallCon,
nosoheaders;
nosoheaders, nosoblock;

type

Expand Down Expand Up @@ -138,6 +138,7 @@ TUpdateLogs = class(TThread)
PSOHash : string[32];
end;

{
BlockHeaderData = Packed Record
Number : Int64;
TimeStart : Int64;
Expand All @@ -154,6 +155,7 @@ TUpdateLogs = class(TThread)
MinerFee : Int64;
Reward : Int64;
end;
}

NetworkData = Packed Record
Value : String[64]; // el valor almacenado
Expand Down Expand Up @@ -576,7 +578,7 @@ TForm1 = class(TForm)
RestartFileName = 'launcher.sh';
updateextension = 'tgz';
{$ENDIF}
SubVersion = 'Ca5';
SubVersion = 'Ca6';
OficialRelease = false;
BetaRelease = true;
VersionRequired = '0.4.2Ba7';
Expand Down Expand Up @@ -846,7 +848,7 @@ TForm1 = class(TForm)

BotDataFilename : string= 'NOSODATA'+DirectorySeparator+'botdata.psk';
//WalletFilename : string= 'NOSODATA'+DirectorySeparator+'wallet.pkw';
BlockDirectory : string= 'NOSODATA'+DirectorySeparator+'BLOCKS'+DirectorySeparator;
//BlockDirectory : string= 'NOSODATA'+DirectorySeparator+'BLOCKS'+DirectorySeparator;
MarksDirectory : string= 'NOSODATA'+DirectorySeparator+'SUMMARKS'+DirectorySeparator;
GVTMarksDirectory : string= 'NOSODATA'+DirectorySeparator+'SUMMARKS'+DirectorySeparator+'GVTS'+DirectorySeparator;
UpdatesDirectory : string= 'NOSODATA'+DirectorySeparator+'UPDATES'+DirectorySeparator;
Expand Down Expand Up @@ -1444,41 +1446,13 @@ constructor TThreadIndexer.Create(CreateSuspended : boolean);
end;

procedure TThreadIndexer.Execute;
var
resultorder : TOrderGroup;
ArrTrxs : TBlockOrdersArray;
Counter : integer;
NewRec : TOrdIndex;
IsCompleted : boolean = false;
Begin
AddNewOpenThread('Indexer',UTCTime);
MyLastOrdIndex := GetMyLastUpdatedBlock-1008;
if MyLastOrdIndex < 0 then MyLastOrdIndex := 0;
ToLog('console',format('Indexer starts at block %d',[MyLastOrdIndex]));
while not terminated do
begin
if MyLastOrdIndex < MyLAstBlock then
begin
NewRec := Default(TOrdIndex);
NewRec.block:=MyLastOrdIndex;
ArrTrxs := GetBlockTrxs(MyLastOrdIndex);
if length(ArrTrxs)>0 then
begin
for counter := 0 to high(ArrTrxs) do
begin
NewRec.orders:=NewRec.orders+ArrTrxs[counter].OrderID+',';
end;

end;
Insert(NewRec,ArrayOrdIndex,Length(ArrayOrdIndex));
Inc(MyLastOrdIndex);
if ( (MyLastOrdIndex = MyLastBlock) and (IsCompleted = false) ) then
begin
ToLog('console',format('OrderIDs index updated at block %d',[MyLastOrdIndex]));
IsCompleted := true;
end;
end;
sleep(10);
if GetMyLastUpdatedBlock > GetDBLastBlock then
UpdateBlockDatabase;
sleep(1000);
end;
CloseOpenThread('Indexer');
End;
Expand Down Expand Up @@ -1648,7 +1622,7 @@ procedure TForm1.FormShow(sender: TObject);
Halt();
end;
MixTxtFiles([DeepDebLogFilename,ConsoleLogFilename,EventLogFilename,ExceptLogFilename,NodeFTPLogFilename,PerformanceFIlename],ResumeLogFilename,true);
InitDeepDeb(DeepDebLogFilename,'Starting DeepDebug session');
InitDeepDeb(DeepDebLogFilename,format('( %s - %s )',[ProgramVersion+subversion, OSVersion]));
NosoDebug_UsePerformance := true;
UpdateLogsThread := TUpdateLogs.Create(true);
UpdateLogsThread.FreeOnTerminate:=true;
Expand All @@ -1663,10 +1637,14 @@ procedure TForm1.FormShow(sender: TObject);
VerifyFiles();
if ( (not fileExists(ClosedAppFilename)) and (WO_Sendreport) ) then
begin
// Send the report file here
OutText('Bug report sent to developers',false,1); //✓ GUI initialized
if SEndFileViaTCP(ResumeLogFilename,'REPORT','141.11.192.215',18081) then
begin
OutText('✓ Bug report sent to developers',false,1);
TryDeleteFile(ClosedAppFilename);
end
else OutText('✓ Error sending report to developers',false,1);
end;
TryDeleteFile(ClosedAppFilename);

InicializarGUI();
//InitTime();
GetTimeOffset(PArameter(GetNosoCFGString,2));
Expand Down Expand Up @@ -2269,13 +2247,6 @@ function TForm1.ClientsCount : Integer ;
end;
End;

Function SendFileToClient(Message:String;filename:string):Boolean;
var
MyStream : TMemoryStream;
Begin

end;

// Node server gets a line
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
Expand Down
2 changes: 1 addition & 1 deletion mpblock.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils,MasterPaskalForm, fileutil, mpcoin, dialogs, math,
nosotime, mpMN, nosodebug,nosogeneral,nosocrypto, nosounit, strutils,
nosopsos,nosowallcon,nosoheaders;
nosopsos,nosowallcon,nosoheaders, nosoblock;

Procedure CrearBloqueCero();
Procedure BuildNewBlock(Numero,TimeStamp: Int64; TargetHash, Minero, Solucion:String);
Expand Down
2 changes: 1 addition & 1 deletion mpcoin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface

uses
Classes, SysUtils,MasterPaskalForm,mpgui,Clipbrd, strutils, nosodebug,nosogeneral,
nosocrypto, nosounit,nosotime,nosopsos,nosowallcon;
nosocrypto, nosounit,nosotime,nosopsos,nosowallcon, nosoblock;

function GetAddressAvailable(address:string):int64;
function GetAddressPendingPays(Address:string):int64;
Expand Down
8 changes: 7 additions & 1 deletion mpdisk.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface
lclintf, controls, mpBlock, Zipper, mpcoin, mpMn, nosodebug,
{$IFDEF WINDOWS}Win32Proc, {$ENDIF}
translation, strutils,nosogeneral, nosocrypto, nosounit, nosoconsensus, nosopsos,
nosowallcon, nosoheaders, nosonosocfg;
nosowallcon, nosoheaders, nosonosocfg, nosoblock;

Function FileStructure():integer;
Procedure VerifyFiles();
Expand Down Expand Up @@ -91,6 +91,8 @@ implementation
if not CreateDir(GVTMarksDirectory) then Inc(Result);
if not directoryexists(RPCBakDirectory) then
if not CreateDir(RPCBakDirectory) then Inc(Result);
if not directoryexists(BlockDirectory+DBDirectory) then
if not CreateDir(BlockDirectory+DBDirectory) then Inc(Result);
End;

// Complete file verification
Expand Down Expand Up @@ -146,6 +148,10 @@ implementation
if not Fileexists(ResumenFilename) then CreateHeadersFile();
OutText('✓ Headers file ok',false,1);

if not FileExists(BlockDirectory+DBDirectory+DataBaseFilename) then CreateDBFile;
OutText('✓ Database file ok. Creating index',false,1);
CreateOrderIDIndex;

if not FileExists(BlockDirectory+'0.blk') then CrearBloqueCero();
MyLastBlock := GetMyLastUpdatedBlock;
OutText('✓ My last block verified: '+MyLastBlock.ToString,false,1);
Expand Down
4 changes: 2 additions & 2 deletions mpgui.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, MasterPaskalForm, nosotime, graphics, strutils, forms, controls, grids,stdctrls,
ExtCtrls, buttons, editbtn , menus, Clipbrd, IdContext, LCLTranslator, nosodebug, nosogeneral,
nosocrypto, nosoconsensus,nosounit, nosopsos, nosowallcon;
nosocrypto, nosoconsensus,nosounit, nosopsos, nosowallcon,nosoblock;

type
TFormInicio = class(Tform)
Expand Down Expand Up @@ -409,7 +409,7 @@ procedure TFormSlots.GridMSlotsPrepareCanvas(sender: TObject; aCol, aRow: Intege
form1.DataPanel.Cells[3,0]:= format('[%d - %d] %s / %s',[GEtPSOHeaders.MNsLock,GetPSOHeaders.count,Copy(PSOFileHash,0,5),GetConsensus(20)]);
form1.DataPanel.Cells[3,1]:= Format('[%s] %s Noso',[BlockAge.ToString,Copy(Int2curr(GetBlockReward(Mylastblock+1)),0,5)]);
form1.DataPanel.Cells[3,2]:= GEtOutgoingconnections.ToString+'/'+GetClientReadThreads.ToString;
form1.DataPanel.Cells[3,3]:= Format('%d (%d)',[MyLastOrdIndex,length(ArrayOrdIndex)]);
form1.DataPanel.Cells[3,3]:= Format('%d (%d)',[GetDBLastBlock,GetDBRecords]);
form1.DataPanel.Cells[3,4]:= format('%s / %s',[Copy(HashMd5String(GetNosoCFGString),0,5),GetConsensus(19)]);
form1.DataPanel.Cells[3,5]:= format('%s / %s',[Copy(MyGVTsHash,0,5),GetConsensus(18)]);
form1.DataPanel.Cells[3,6]:= format('%s / %s',[Copy(MyMNsHash,0,5),GetConsensus(8)]);
Expand Down
6 changes: 5 additions & 1 deletion mpparser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface
Classes, SysUtils, MasterPaskalForm, mpGUI, mpRed, mpDisk, nosotime, mpblock, mpcoin,
dialogs, fileutil, forms, idglobal, strutils, mpRPC, DateUtils, Clipbrd,translation,
idContext, math, mpMN, MPSysCheck, nosodebug, nosogeneral, nosocrypto, nosounit,
nosoconsensus, nosopsos,nosowallcon, nosoheaders;
nosoconsensus, nosopsos,nosowallcon, nosoheaders, nosoblock;

procedure ProcessLinesAdd(const ALine: String);
procedure OutgoingMsjsAdd(const ALine: String);
Expand Down Expand Up @@ -275,6 +275,10 @@ function GetOpData(textLine:string):String;
begin
SetCFGData(GetRepoFile('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)



// New system

Expand Down
2 changes: 1 addition & 1 deletion mpprotocol.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, mpRed, MasterPaskalForm, mpParser, StrUtils, mpDisk, nosotime, mpBlock,
Zipper, mpcoin, mpMn, nosodebug, nosogeneral, nosocrypto, nosounit,nosoconsensus,nosopsos,
nosoheaders, NosoNosoCFG;
nosoheaders, NosoNosoCFG, nosoblock;

function GetPTCEcn():String;
Function GetOrderFromString(textLine:String):TOrderData;
Expand Down
4 changes: 2 additions & 2 deletions mpred.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface
mpBlock, fileutil, graphics, dialogs, strutils, mpcoin, fphttpclient,
opensslsockets,translation, IdHTTP, IdComponent, IdSSLOpenSSL, mpmn, IdTCPClient,
nosodebug,nosogeneral, nosocrypto, nosounit, nosoconsensus, nosopsos,nosowallcon,
nosoheaders;
nosoheaders, nosoblock;

function GetSlotFromIP(Ip:String):int64;
function GetSlotFromContext(Context:TidContext):int64;
Expand Down Expand Up @@ -250,7 +250,7 @@ procedure StartServer();
U_DataPanel := true;
except
on E : Exception do
ToLog('events',TimeToStr(now)+'Unable to start Server'); //Unable to start Server
ToLog('events',TimeToStr(now)+'Unable to start Server: '+e.Message); //Unable to start Server
end;
end;
End;
Expand Down
29 changes: 27 additions & 2 deletions mprpc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function RPC_Masternodes(NosoPParams:string):string;
function RPC_Blockmns(NosoPParams:string):string;
Function RPC_WalletBalance(NosoPParams:string):string;
function RPC_NewAddress(NosoPParams:string):string;
function RPC_NewAddressFull(NosoPParams:string):string;
Function RPC_ValidateAddress(NosoPParams:string):string;
Function RPC_SetDefault(NosoPParams:string):string;
Function RPC_GVTInfo(NosoPParams:string):string;
Expand Down Expand Up @@ -381,6 +382,12 @@ function ObjectFromString(MyString:string): string;
resultado.Add('count',StrToIntDef(parameter(mystring,2),-1));
resultado.Add('nodes',parameter(mystring,3));
end
else if objecttype = 'newaddressfull' then
begin
resultado.Add('hash',parameter(mystring,1));
resultado.Add('public',parameter(mystring,2));
resultado.Add('private',parameter(mystring,3));
end
else if objecttype = 'newaddress' then
begin
//resultado.Add('valid',StrToBool(parameter(mystring,1)));
Expand Down Expand Up @@ -468,6 +475,7 @@ function ParseRPCJSON(jsonreceived:string):string;
else if method = 'getmasternodes' then result := GetJSONResponse(RPC_Masternodes(NosoPParams),jsonid)
else if method = 'getwalletbalance' then result := GetJSONResponse(RPC_WalletBalance(NosoPParams),jsonid)
else if method = 'getnewaddress' then result := GetJSONResponse(RPC_NewAddress(NosoPParams),jsonid)
else if method = 'getnewaddressfull' then result := GetJSONResponse(RPC_NewAddressFull(NosoPParams),jsonid)
else if method = 'islocaladdress' then result := GetJSONResponse(RPC_ValidateAddress(NosoPParams),jsonid)
else if method = 'setdefault' then result := GetJSONResponse(RPC_SetDefault(NosoPParams),jsonid)
else if method = 'getgvtinfo' then result := GetJSONResponse(RPC_GVTInfo(NosoPParams),jsonid)
Expand Down Expand Up @@ -800,7 +808,6 @@ function RPC_NewAddress(NosoPParams:string):string;
Begin
TotalNumber := StrToIntDef(NosoPParams,1);
if TotalNumber > 100 then TotalNumber := 100;
//ToLog('console','TotalNewAddresses: '+IntToStr(TotalNumber));
result := 'newaddress'#127'true'#127+IntToStr(TotalNumber)+#127;
for counter := 1 to totalnumber do
begin
Expand All @@ -815,7 +822,25 @@ function RPC_NewAddress(NosoPParams:string):string;
trim(result);
S_Wallet := true;
U_DirPanel := true;
//ToLog('console',result);
End;

function RPC_NewAddressFull(NosoPParams:string):string;
var
counter : integer;
NewAddress : WalletData;
PubKey,PriKey : string;
Begin
result := 'newaddressfull'#127;
NewAddress := Default(WalletData);
NewAddress.Hash:=GenerateNewAddress(PubKey,PriKey);
NewAddress.PublicKey:=pubkey;
NewAddress.PrivateKey:=PriKey;
InsertToWallArr(NewAddress);
if RPCSaveNew then SaveAddresstoFile(RPCBakDirectory+NewAddress.Hash+'.pkw',NewAddress);
Result := result+NewAddress.Hash+#127+NewAddress.PublicKey+#127+NewAddress.PrivateKey;
trim(result);
S_Wallet := true;
U_DirPanel := true;
End;

Function RPC_ValidateAddress(NosoPParams:string):string;
Expand Down

0 comments on commit 62cabf0

Please sign in to comment.