From 5f619c78877a893881a20053dc19b77f059e3148 Mon Sep 17 00:00:00 2001 From: NosoDevTeam <142863157+NosoDevTeam@users.noreply.github.com> Date: Mon, 2 Sep 2024 20:33:03 +0200 Subject: [PATCH] protocol changes --- lastrelease.txt | 2 +- masterpaskalform.lfm | 23 ++--------------------- masterpaskalform.pas | 17 +---------------- mpblock.pas | 6 ++++-- mpgui.pas | 20 -------------------- mpparser.pas | 7 +++++++ mpprotocol.pas | 31 ++++++++++++++----------------- 7 files changed, 29 insertions(+), 77 deletions(-) diff --git a/lastrelease.txt b/lastrelease.txt index 0201014..478ac47 100644 --- a/lastrelease.txt +++ b/lastrelease.txt @@ -1 +1 @@ -0.4.3Aa7 0.4.2Da2 x {LastOfficial} {LastBeta} {TestNet} \ No newline at end of file +0.4.3Aa8 0.4.2Da2 x {LastOfficial} {LastBeta} {TestNet} \ No newline at end of file diff --git a/masterpaskalform.lfm b/masterpaskalform.lfm index cd9052c..67d511b 100644 --- a/masterpaskalform.lfm +++ b/masterpaskalform.lfm @@ -318,7 +318,7 @@ object Form1: TForm1 Height = 488 Top = 38 Width = 640 - ActivePage = TabConsole + ActivePage = TabWallet Align = alTop Anchors = [akTop, akLeft, akRight, akBottom] Font.CharSet = ANSI_CHARSET @@ -327,7 +327,7 @@ object Form1: TForm1 Font.Pitch = fpVariable Font.Quality = fqDraft ParentFont = False - TabIndex = 1 + TabIndex = 0 TabOrder = 0 object TabWallet: TTabSheet Caption = 'Wallet' @@ -765,25 +765,6 @@ object Form1: TForm1 end end end - object TabSheet2: TTabSheet - Caption = 'Offers' - ClientHeight = 432 - ClientWidth = 624 - object OffersGrid: TStringGrid - Left = 0 - Height = 432 - Top = 0 - Width = 624 - Align = alClient - ColCount = 4 - FixedCols = 0 - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRowSelect, goSmoothScroll] - RowCount = 1 - ScrollBars = ssVertical - TabOrder = 0 - OnResize = OffersGridResize - end - end end end object TabConsole: TTabSheet diff --git a/masterpaskalform.pas b/masterpaskalform.pas index 13a968d..1c31eac 100644 --- a/masterpaskalform.pas +++ b/masterpaskalform.pas @@ -293,7 +293,6 @@ TForm1 = class(TForm) Edit2: TEdit; Label19: TLabel; Memobannedmethods: TMemo; - OffersGrid: TStringGrid; Label1: TLabel; Label14: TLabel; Label15: TLabel; @@ -348,7 +347,6 @@ TForm1 = class(TForm) TabSheet1: TTabSheet; TabNodesReported: TTabSheet; TabNodesVerified: TTabSheet; - TabSheet2: TTabSheet; TabThreads: TTabSheet; TabFiles: TTabSheet; StaTimeLab: TLabel; @@ -470,7 +468,6 @@ TForm1 = class(TForm) procedure MemobannedmethodsEditingDone(Sender: TObject); procedure MemoRPCWhitelistEditingDone(sender: TObject); - procedure OffersGridResize(Sender: TObject); procedure PC_ProcessesResize(Sender: TObject); Procedure RestartTimerEjecutar(sender: TObject); Procedure StartProgram(); @@ -576,7 +573,7 @@ TForm1 = class(TForm) RestartFileName = 'launcher.sh'; updateextension = 'tgz'; {$ENDIF} - NodeRelease = 'Aa7'; + NodeRelease = 'Aa8'; OficialRelease = true; BetaRelease = false; VersionRequired = '0.4.2'; @@ -2026,18 +2023,6 @@ procedure TForm1.GVTsGridResize(sender: TObject); form1.GVTsGrid.ColWidths[1]:= thispercent(80,GridWidth,true); End; -// Resize: Offers grid -procedure TForm1.OffersGridResize(Sender: TObject); -var - GridWidth : integer; -Begin - GridWidth := form1.OffersGrid.Width; - form1.OffersGrid.ColWidths[0]:= thispercent(15,GridWidth); - form1.OffersGrid.ColWidths[1]:= thispercent(15,GridWidth); - form1.OffersGrid.ColWidths[2]:= thispercent(15,GridWidth); - form1.OffersGrid.ColWidths[3]:= thispercent(55,GridWidth,true); -End; - {$ENDREGION} {$REGION To Re-evaluate} diff --git a/mpblock.pas b/mpblock.pas index cd94778..db7d6f8 100644 --- a/mpblock.pas +++ b/mpblock.pas @@ -121,7 +121,7 @@ implementation NPDSource : string; NPDTarget : string; NPDAmount : int64; - + BlockTrfrs : integer = 0; Begin if WO_skipBlocks then exit; @@ -183,7 +183,7 @@ implementation end; end; if ExistsInLastBlock then continue; - if ArrayPoolTXs[contador].TimeStamp+60 > TimeStamp then + if ( (ArrayPoolTXs[contador].TimeStamp+60 > TimeStamp) or (BlockTrfrs>=2000) ) then begin if ArrayPoolTXs[contador].TimeStamp < TimeStamp+600 then insert(ArrayPoolTXs[contador],IgnoredTrxs,length(IgnoredTrxs)); @@ -198,6 +198,7 @@ implementation ArrayPoolTXs[contador].Block:=numero; ArrayPoolTXs[contador].sender:=OperationAddress; insert(ArrayPoolTXs[contador],ListaOrdenes,length(listaordenes)); + Inc(BlockTrfrs); end; end; if ArrayPoolTXs[contador].OrderType='TRFR' then @@ -210,6 +211,7 @@ implementation ArrayPoolTXs[contador].Block:=numero; ArrayPoolTXs[contador].sender:=OperationAddress; insert(ArrayPoolTXs[contador],ListaOrdenes,length(listaordenes)); + Inc(BlockTrfrs); end; end; if ( (ArrayPoolTXs[contador].OrderType='SNDGVT') and ( ArrayPoolTXs[contador].sender = AdminPubKey) ) then diff --git a/mpgui.pas b/mpgui.pas index 3ac338a..d2d9704 100644 --- a/mpgui.pas +++ b/mpgui.pas @@ -257,11 +257,6 @@ procedure TFormSlots.GridMSlotsPrepareCanvas(sender: TObject; aCol, aRow: Intege form1.GVTsGrid.Cells[1,0] := 'Address'; form1.GVTsGrid.FocusRectVisible:=false; -form1.OffersGrid.Cells[0,0] := 'Mode'; -form1.OffersGrid.Cells[1,0] := 'Expire'; -form1.OffersGrid.Cells[2,0] := 'Fee'; -form1.OffersGrid.Cells[3,0] := 'Owner'; -form1.OffersGrid.FocusRectVisible:=false; End; // Ordena las salidas de informacion @@ -291,7 +286,6 @@ procedure TFormSlots.GridMSlotsPrepareCanvas(sender: TObject; aCol, aRow: Intege LastUpdateProcesses : int64 = 0; LastUpdateConsensus : int64 = 0; LastUpdateDataPanel : int64 = 0; - LastUpdatePSO : int64 = 0; var contador : integer = 0; LocalProcesses : TProcessCopy; @@ -342,20 +336,6 @@ procedure TFormSlots.GridMSlotsPrepareCanvas(sender: TObject; aCol, aRow: Intege end; end; -if LastUpdatePSO <> UTCTime then - begin - LPSOs := GetPSOsCopy; - Form1.OffersGrid.RowCount:=Length(LPSOs)+1; - for contador := 0 to length(LPSOs)-1 do - begin - Form1.OffersGrid.Cells[0,contador+1]:=LPSOs[contador].Mode.ToString; - Form1.OffersGrid.Cells[1,contador+1]:=LPSOs[contador].Expire.ToString; - Form1.OffersGrid.Cells[2,contador+1]:=GetPSOValue(PSOFee,LPSOs[contador].Params); - Form1.OffersGrid.Cells[3,contador+1]:=LPSOs[contador].owner; - end; - LAstUpdatePSO := UTCTime; - end; - if LastUpdateProcesses<> UTCTime then begin if form1.PC_Processes.ActivePage = Form1.TabThreads then diff --git a/mpparser.pas b/mpparser.pas index b1e90f3..960b75a 100644 --- a/mpparser.pas +++ b/mpparser.pas @@ -720,6 +720,7 @@ function SendFunds(LineText:string;showOutput:boolean=true):string; ResultOrderID : String = ''; CoinsAvailable : int64; DestinationRecord : TSummaryData; + SendersString : string = ''; Begin result := ''; BeginPerformance('SendFunds'); @@ -772,6 +773,12 @@ function SendFunds(LineText:string;showOutput:boolean=true):string; while monto > 0 do begin BeginPerformance('SendFundsVerify'); + if AnsiContainsstr(SendersString,GetWallArrIndex(contador).Hash) then + begin + ToLog('console','Duplicated address on order'); + Exit; + end; + SendersString := SendersString+GetWallArrIndex(contador).Hash; if GetAddressBalanceIndexed(GetWallArrIndex(contador).Hash)-GetAddressPendingPays(GetWallArrIndex(contador).Hash) > 0 then begin trxLinea := TrxLinea+1; diff --git a/mpprotocol.pas b/mpprotocol.pas index 57f17eb..94eed41 100644 --- a/mpprotocol.pas +++ b/mpprotocol.pas @@ -858,14 +858,20 @@ function ValidateTrfr(order:Torderdata;Origen:String):integer; Result := ''; TRY NumTransfers := StrToInt(Parameter(TextLine,5)); -ToLog('Console',format('Order with %d transfers',[Numtransfers])); -ToLog('Console',format('Complete line: %s',[TextLine])); +ToLog('events',format('Order with %d transfers',[Numtransfers])); +ToLog('events',format('Complete line: %s',[TextLine])); RecOrderId := Parameter(TextLine,7); GenOrderID := Parameter(TextLine,5)+Parameter(TextLine,10); Textbak := GetOpData(TextLine); SetLength(TrxArray,0);SetLength(senderTrx,0); +if NumTransfers > 30 then + begin + Proceder := false; + ErrorCode := 89; + end; for cont := 0 to NumTransfers-1 do begin + if not Proceder then Break; SetLength(TrxArray,length(TrxArray)+1);SetLength(senderTrx,length(senderTrx)+1); if not GetOrderFromString(Textbak,TrxArray[cont]) then begin @@ -887,33 +893,25 @@ function ValidateTrfr(order:Torderdata;Origen:String):integer; ErrorCode := 97; //ToLog('console',format('error: %s <> %s',[senderTrx[cont],TrxArray[cont].Address ])) end; - if pos(sendersString,senderTrx[cont]) > 0 then + if AnsiContainsstr(sendersString,senderTrx[cont]) then begin - Proceder:=false; // hay una direccion de envio repetida + Proceder:=false; // sender duplicated ErrorCode := 99; end; sendersString := sendersString + senderTrx[cont]; Textbak := copy(textBak,2,length(textbak)); Textbak := GetOpData(Textbak); - if not Proceder then Break; end; GenOrderID := GetOrderHash(GenOrderID); -if TotalFee >= GetMinimumFee(TotalSent) then +if TotalFee < GetMinimumFee(TotalSent) then begin - //ToLog('console',Format('Order fees match : %d >= %d',[TotalFee,GetFee(TotalSent)])) - end -else - begin - //ToLog('console',Format('WRONG ORDER FEES : %d >= %d',[TotalFee,GetFee(TotalSent)])); TodoValido := false; ErrorCode := 100; end; if RecOrderId<>GenOrderID then begin - //ToLog('console','<-'+RecOrderId); - //ToLog('console','->'+GenOrderID); - if mylastblock >= 56000 then TodoValido := false; - if mylastblock >= 56000 then ErrorCode := 101; + TodoValido := false; + ErrorCode := 101; end; if TodoValido then begin @@ -940,8 +938,7 @@ function ValidateTrfr(order:Torderdata;Origen:String):integer; end else begin - if ErrorCode>0 then - if mylastblock >= 56000 then Result := 'ERROR '+ErrorCode.ToString; + if ErrorCode>0 then Result := 'ERROR '+ErrorCode.ToString; end; EXCEPT ON E:EXCEPTION DO begin