Browse Source

Build 1.5.5

Build 1.5.5
PascalCoin 8 years ago
parent
commit
73e06e9447

BIN
PascalCoinWallet.res


+ 7 - 0
README.md

@@ -34,6 +34,13 @@ Also, consider a donation at PascalCoin development account: "0-10"
 
 ## History:  
 
+### Build 1.5.5.0 - 2017-04-11
+- Corrected fee result on RPC calls as a negative number on "Change key" operations
+- Corrected PASCURRENCY value to be limited as a 4 decimal digits on RPC calls
+- JSON-RPC method "getaccountoperations" changed: if param "start" is -1, will include pending operations, otherwise not
+- Fixed bug: On "getaccountoperations" if an account had a lot of operations (receive tx included) then sometimes app crashed when executing depth search.
+  - Note: High depth search is slow because it search always starting from current state, going backwards, in order to return past balance. This can be a slow method on some account with high transactions volume.
+
 ### Build 1.5.4.0 - 2017-03-14
 
 - Added Network Timestamp Adjustment (NAT) to calc valid timestamps

+ 7 - 0
README.txt

@@ -34,6 +34,13 @@ Also, consider a donation at PascalCoin development account: "0-10"
 
 ## History:  
 
+### Build 1.5.5.0 - 2017-04-11
+- Corrected fee result on RPC calls as a negative number on "Change key" operations
+- Corrected PASCURRENCY value to be limited as a 4 decimal digits on RPC calls
+- JSON-RPC method "getaccountoperations" changed: if param "start" is -1, will include pending operations, otherwise not
+- Fixed bug: On "getaccountoperations" if an account had a lot of operations (receive tx included) then sometimes app crashed when executing depth search.
+  - Note: High depth search is slow because it search always starting from current state, going backwards, in order to return past balance. This can be a slow method on some account with high transactions volume.
+
 ### Build 1.5.4.0 - 2017-03-14
 
 - Added Network Timestamp Adjustment (NAT) to calc valid timestamps

+ 21 - 1
Units/Forms/UFRMWallet.dfm

@@ -595,6 +595,10 @@ object FRMWallet: TFRMWallet
         object tsMultiSelectAccounts: TTabSheet
           Caption = 'Selected accounts for massive operations'
           ImageIndex = 1
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object dgSelectedAccounts: TDrawGrid
             Left = 41
             Top = 31
@@ -784,6 +788,10 @@ object FRMWallet: TFRMWallet
     object tsPendingOperations: TTabSheet
       Caption = 'Pending Operations'
       ImageIndex = 5
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object dgPendingOperations: TDrawGrid
         Left = 0
         Top = 86
@@ -831,6 +839,10 @@ object FRMWallet: TFRMWallet
     object tsBlockChain: TTabSheet
       Caption = 'BlockChain Explorer'
       ImageIndex = 1
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object Panel2: TPanel
         Left = 0
         Top = 0
@@ -876,6 +888,10 @@ object FRMWallet: TFRMWallet
     object tsOperations: TTabSheet
       Caption = 'Operations Explorer'
       ImageIndex = 1
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object Panel1: TPanel
         Left = 0
         Top = 0
@@ -921,6 +937,10 @@ object FRMWallet: TFRMWallet
     object tsLogs: TTabSheet
       Caption = 'Logs'
       ImageIndex = 2
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object pnlTopLogs: TPanel
         Left = 0
         Top = 0
@@ -1249,7 +1269,7 @@ object FRMWallet: TFRMWallet
     Left = 105
     Top = 180
     Bitmap = {
-      494C010102000800E80110003000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+      494C010102000800EC0110003000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
       0000000000003600000028000000400000003000000001002000000000000030
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000002A292929D60B0B0BF4111111EE0000006B000000000000

+ 107 - 104
Units/Forms/UFRMWallet.lfm

@@ -4,7 +4,7 @@ object FRMWallet: TFRMWallet
   Top = 201
   Width = 865
   Caption = 'Pascal Coin Wallet, JSON-RPC Miner & Explorer'
-  ClientHeight = 600
+  ClientHeight = 580
   ClientWidth = 865
   Color = clBtnFace
   Constraints.MinHeight = 600
@@ -162,7 +162,7 @@ object FRMWallet: TFRMWallet
       Left = 90
       Height = 13
       Top = 11
-      Width = 70
+      Width = 60
       Caption = 'Total Blocks:'
       ParentColor = False
     end
@@ -170,7 +170,7 @@ object FRMWallet: TFRMWallet
       Left = 166
       Height = 13
       Top = 11
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -178,7 +178,7 @@ object FRMWallet: TFRMWallet
       Left = 90
       Height = 13
       Top = 26
-      Width = 106
+      Width = 89
       Caption = 'Current Block age:'
       ParentColor = False
     end
@@ -186,7 +186,7 @@ object FRMWallet: TFRMWallet
       Left = 198
       Height = 13
       Top = 26
-      Width = 96
+      Width = 81
       Caption = '000 seconds ago'
       ParentColor = False
     end
@@ -194,7 +194,7 @@ object FRMWallet: TFRMWallet
       Left = 90
       Height = 13
       Top = 41
-      Width = 115
+      Width = 98
       Caption = 'Pending Operations:'
       ParentColor = False
     end
@@ -202,7 +202,7 @@ object FRMWallet: TFRMWallet
       Left = 207
       Height = 13
       Top = 41
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -210,7 +210,7 @@ object FRMWallet: TFRMWallet
       Left = 90
       Height = 13
       Top = 56
-      Width = 81
+      Width = 68
       Caption = 'Miners clients:'
       ParentColor = False
     end
@@ -218,7 +218,7 @@ object FRMWallet: TFRMWallet
       Left = 177
       Height = 13
       Top = 56
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -226,7 +226,7 @@ object FRMWallet: TFRMWallet
       Left = 429
       Height = 13
       Top = 11
-      Width = 86
+      Width = 76
       Caption = 'Current Target:'
       ParentColor = False
     end
@@ -234,7 +234,7 @@ object FRMWallet: TFRMWallet
       Left = 518
       Height = 13
       Top = 11
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -242,7 +242,7 @@ object FRMWallet: TFRMWallet
       Left = 370
       Height = 13
       Top = 26
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -250,7 +250,7 @@ object FRMWallet: TFRMWallet
       Left = 285
       Height = 13
       Top = 26
-      Width = 83
+      Width = 69
       Caption = 'Time average:'
       ParentColor = False
     end
@@ -258,7 +258,7 @@ object FRMWallet: TFRMWallet
       Left = 90
       Height = 13
       Top = 70
-      Width = 72
+      Width = 63
       Caption = 'Node Status:'
       ParentColor = False
     end
@@ -266,7 +266,7 @@ object FRMWallet: TFRMWallet
       Left = 168
       Height = 13
       Top = 70
-      Width = 18
+      Width = 15
       Caption = '???'
       ParentColor = False
     end
@@ -274,7 +274,7 @@ object FRMWallet: TFRMWallet
       Left = 285
       Height = 13
       Top = 11
-      Width = 55
+      Width = 48
       Caption = 'Accounts:'
       ParentColor = False
     end
@@ -282,7 +282,7 @@ object FRMWallet: TFRMWallet
       Left = 344
       Height = 13
       Top = 11
-      Width = 21
+      Width = 18
       Caption = '000'
       ParentColor = False
     end
@@ -290,7 +290,7 @@ object FRMWallet: TFRMWallet
       Left = 370
       Height = 13
       Top = 41
-      Width = 21
+      Width = 18
       Caption = '000'
       Font.Color = clGray
       Font.Height = -11
@@ -302,7 +302,7 @@ object FRMWallet: TFRMWallet
       Left = 360
       Height = 13
       Top = 56
-      Width = 86
+      Width = 74
       Caption = 'Blocks found:'
       Font.Color = clWindowText
       Font.Height = -11
@@ -316,7 +316,7 @@ object FRMWallet: TFRMWallet
       Height = 13
       Hint = 'Blocks found while Miner is running...'
       Top = 56
-      Width = 24
+      Width = 21
       Caption = '000'
       Font.Color = clWindowText
       Font.Height = -11
@@ -330,9 +330,9 @@ object FRMWallet: TFRMWallet
     object lblReceivedMessages: TLabel
       Cursor = crHandPoint
       Left = 360
-      Height = 22
+      Height = 23
       Top = 66
-      Width = 211
+      Width = 185
       Caption = 'Received messages'
       Font.Color = clRed
       Font.Height = -19
@@ -344,9 +344,9 @@ object FRMWallet: TFRMWallet
     end
     object lblBuild: TLabel
       Left = 586
-      Height = 22
+      Height = 23
       Top = 3
-      Width = 56
+      Width = 49
       Caption = 'Build'
       Font.Color = clWindowText
       Font.Height = -19
@@ -358,8 +358,8 @@ object FRMWallet: TFRMWallet
   end
   object StatusBar: TStatusBar
     Left = 0
-    Height = 21
-    Top = 579
+    Height = 23
+    Top = 557
     Width = 865
     Panels = <    
       item
@@ -379,7 +379,7 @@ object FRMWallet: TFRMWallet
   end
   object PageControl: TPageControl
     Left = 0
-    Height = 488
+    Height = 466
     Top = 91
     Width = 865
     ActivePage = tsMyAccounts
@@ -389,11 +389,11 @@ object FRMWallet: TFRMWallet
     OnChange = PageControlChange
     object tsMyAccounts: TTabSheet
       Caption = 'Accounts Explorer'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       object Splitter1: TSplitter
         Left = 380
-        Height = 395
+        Height = 374
         Top = 66
         Width = 5
       end
@@ -401,41 +401,42 @@ object FRMWallet: TFRMWallet
         Left = 0
         Height = 66
         Top = 0
-        Width = 861
+        Width = 857
         Align = alTop
+        BevelOuter = bvNone
         ClientHeight = 66
-        ClientWidth = 861
+        ClientWidth = 857
         TabOrder = 0
         object Label18: TLabel
           Left = 11
           Height = 13
           Top = 35
-          Width = 70
+          Width = 61
           Caption = 'Find account'
           ParentColor = False
         end
         object cbMyPrivateKeys: TComboBox
           Left = 260
-          Height = 31
+          Height = 21
           Top = 7
           Width = 411
-          ItemHeight = 0
+          ItemHeight = 13
           OnChange = cbMyPrivateKeysChange
           Style = csDropDownList
           TabOrder = 0
         end
         object cbExploreMyAccounts: TCheckBox
           Left = 11
-          Height = 24
+          Height = 19
           Top = 10
-          Width = 329
+          Width = 235
           Caption = 'Explore accounts with one of my Wallet Keys'
           OnClick = cbExploreMyAccountsClick
           TabOrder = 1
         end
         object ebFindAccountNumber: TEdit
           Left = 87
-          Height = 23
+          Height = 21
           Top = 33
           Width = 83
           OnChange = ebFindAccountNumberChange
@@ -453,16 +454,16 @@ object FRMWallet: TFRMWallet
         end
         object cbFilterAccounts: TCheckBox
           Left = 260
-          Height = 24
+          Height = 19
           Top = 35
-          Width = 202
+          Width = 145
           Caption = 'Filter accounts by balance'
           OnClick = cbFilterAccountsClick
           TabOrder = 4
         end
         object ebFilterAccountByBalanceMin: TEdit
           Left = 412
-          Height = 23
+          Height = 21
           Hint = 'Min balance'
           Top = 33
           Width = 83
@@ -472,7 +473,7 @@ object FRMWallet: TFRMWallet
         end
         object ebFilterAccountByBalanceMax: TEdit
           Left = 503
-          Height = 23
+          Height = 21
           Hint = 'Max balance'
           Top = 33
           Width = 83
@@ -483,17 +484,17 @@ object FRMWallet: TFRMWallet
       end
       object pnlAccounts: TPanel
         Left = 0
-        Height = 395
+        Height = 374
         Top = 66
         Width = 380
         Align = alLeft
         BevelOuter = bvNone
-        ClientHeight = 395
+        ClientHeight = 374
         ClientWidth = 380
         TabOrder = 1
         object dgAccounts: TDrawGrid
           Left = 0
-          Height = 361
+          Height = 340
           Top = 0
           Width = 380
           Align = alClient
@@ -507,7 +508,7 @@ object FRMWallet: TFRMWallet
         object pnlAccountsInfo: TPanel
           Left = 0
           Height = 34
-          Top = 361
+          Top = 340
           Width = 380
           Align = alBottom
           BevelOuter = bvNone
@@ -518,7 +519,7 @@ object FRMWallet: TFRMWallet
             Left = 5
             Height = 13
             Top = 10
-            Width = 55
+            Width = 48
             Caption = 'Accounts:'
             ParentColor = False
           end
@@ -526,7 +527,7 @@ object FRMWallet: TFRMWallet
             Left = 136
             Height = 13
             Top = 10
-            Width = 49
+            Width = 41
             Caption = 'Balance:'
             ParentColor = False
           end
@@ -534,7 +535,7 @@ object FRMWallet: TFRMWallet
             Left = 60
             Height = 13
             Top = 10
-            Width = 21
+            Width = 18
             Caption = '000'
             ParentColor = False
           end
@@ -542,7 +543,7 @@ object FRMWallet: TFRMWallet
             Left = 200
             Height = 13
             Top = 10
-            Width = 21
+            Width = 18
             Caption = '000'
             ParentColor = False
           end
@@ -588,22 +589,22 @@ object FRMWallet: TFRMWallet
       end
       object pcAccountsOptions: TPageControl
         Left = 385
-        Height = 395
+        Height = 374
         Top = 66
-        Width = 476
+        Width = 472
         ActivePage = tsAccountOperations
         Align = alClient
         TabIndex = 0
         TabOrder = 2
         object tsAccountOperations: TTabSheet
           Caption = 'Operations of selected Account'
-          ClientHeight = 368
-          ClientWidth = 472
+          ClientHeight = 348
+          ClientWidth = 464
           object dgAccountOperations: TDrawGrid
             Left = 0
-            Height = 368
+            Height = 348
             Top = 0
-            Width = 472
+            Width = 464
             Align = alClient
             ExtendedSelect = False
             TabOrder = 0
@@ -813,14 +814,14 @@ object FRMWallet: TFRMWallet
     end
     object tsPendingOperations: TTabSheet
       Caption = 'Pending Operations'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 5
       object dgPendingOperations: TDrawGrid
         Left = 0
-        Height = 375
+        Height = 354
         Top = 86
-        Width = 861
+        Width = 857
         Align = alClient
         ExtendedSelect = False
         TabOrder = 0
@@ -833,18 +834,18 @@ object FRMWallet: TFRMWallet
         Left = 0
         Height = 86
         Top = 0
-        Width = 861
+        Width = 857
         Align = alTop
         BevelOuter = bvNone
         BorderWidth = 10
         ClientHeight = 86
-        ClientWidth = 861
+        ClientWidth = 857
         TabOrder = 1
         object Label10: TLabel
           Left = 10
           Height = 66
           Top = 10
-          Width = 841
+          Width = 837
           Align = alClient
           AutoSize = False
           Caption = 'Here you can see Operations transmited/received from other nodes that will be included in next block. There is no guarantee that other nodes will include them when mining, so it''s important that you mine too to help include Operations to the main BlockChain'
@@ -859,8 +860,8 @@ object FRMWallet: TFRMWallet
     end
     object tsBlockChain: TTabSheet
       Caption = 'BlockChain Explorer'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 1
       object Panel2: TPanel
         Left = 0
@@ -868,6 +869,7 @@ object FRMWallet: TFRMWallet
         Top = 0
         Width = 857
         Align = alTop
+        BevelOuter = bvNone
         ClientHeight = 41
         ClientWidth = 857
         TabOrder = 0
@@ -913,29 +915,30 @@ object FRMWallet: TFRMWallet
     end
     object tsOperations: TTabSheet
       Caption = 'Operations Explorer'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 1
       object Panel1: TPanel
         Left = 0
         Height = 41
         Top = 0
-        Width = 861
+        Width = 857
         Align = alTop
+        BevelOuter = bvNone
         ClientHeight = 41
-        ClientWidth = 861
+        ClientWidth = 857
         TabOrder = 0
         object Label2: TLabel
           Left = 11
           Height = 13
           Top = 10
-          Width = 121
+          Width = 102
           Caption = 'Filter by blocks range'
           ParentColor = False
         end
         object ebFilterOperationsStartBlock: TEdit
           Left = 125
-          Height = 23
+          Height = 21
           Top = 7
           Width = 57
           OnExit = ebFilterOperationsAccountExit
@@ -944,7 +947,7 @@ object FRMWallet: TFRMWallet
         end
         object ebFilterOperationsEndBlock: TEdit
           Left = 185
-          Height = 23
+          Height = 21
           Top = 7
           Width = 57
           OnExit = ebFilterOperationsAccountExit
@@ -954,9 +957,9 @@ object FRMWallet: TFRMWallet
       end
       object dgOperationsExplorer: TDrawGrid
         Left = 0
-        Height = 420
+        Height = 399
         Top = 41
-        Width = 861
+        Width = 857
         Align = alClient
         ExtendedSelect = False
         TabOrder = 1
@@ -967,32 +970,33 @@ object FRMWallet: TFRMWallet
     end
     object tsLogs: TTabSheet
       Caption = 'Logs'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 2
       object pnlTopLogs: TPanel
         Left = 0
         Height = 41
         Top = 0
-        Width = 861
+        Width = 857
         Align = alTop
+        BevelOuter = bvNone
         ClientHeight = 41
-        ClientWidth = 861
+        ClientWidth = 857
         TabOrder = 0
         object cbShowDebugLogs: TCheckBox
           Left = 15
-          Height = 24
+          Height = 19
           Top = 10
-          Width = 145
+          Width = 102
           Caption = 'Show Debug logs'
           TabOrder = 0
         end
       end
       object memoLogs: TMemo
         Left = 0
-        Height = 420
+        Height = 399
         Top = 41
-        Width = 861
+        Width = 857
         Align = alClient
         ScrollBars = ssBoth
         TabOrder = 1
@@ -1001,22 +1005,22 @@ object FRMWallet: TFRMWallet
     end
     object tsNodeStats: TTabSheet
       Caption = 'Node Stats'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 3
       object Label3: TLabel
         Left = 15
         Height = 13
         Top = 15
-        Width = 207
+        Width = 177
         Caption = 'Active Net Connections of this Node:'
         ParentColor = False
       end
       object Label6: TLabel
         Left = 15
         Height = 13
-        Top = 312
-        Width = 202
+        Top = 291
+        Width = 198
         Anchors = [akLeft, akRight, akBottom]
         Caption = 'Available or possible Node Servers:'
         ParentColor = False
@@ -1024,17 +1028,17 @@ object FRMWallet: TFRMWallet
       object Label7: TLabel
         Left = 15
         Height = 13
-        Top = 208
-        Width = 103
+        Top = 187
+        Width = 99
         Anchors = [akLeft, akRight, akBottom]
         Caption = 'BlackList of Nodes'
         ParentColor = False
       end
       object memoNetConnections: TMemo
         Left = 15
-        Height = 166
+        Height = 145
         Top = 34
-        Width = 834
+        Width = 830
         Anchors = [akTop, akLeft, akRight, akBottom]
         ReadOnly = True
         ScrollBars = ssBoth
@@ -1044,8 +1048,8 @@ object FRMWallet: TFRMWallet
       object memoNetServers: TMemo
         Left = 15
         Height = 116
-        Top = 331
-        Width = 834
+        Top = 310
+        Width = 830
         Anchors = [akLeft, akRight, akBottom]
         ReadOnly = True
         ScrollBars = ssBoth
@@ -1055,8 +1059,8 @@ object FRMWallet: TFRMWallet
       object memoNetBlackLists: TMemo
         Left = 16
         Height = 79
-        Top = 227
-        Width = 833
+        Top = 206
+        Width = 829
         Anchors = [akLeft, akRight, akBottom]
         ReadOnly = True
         ScrollBars = ssBoth
@@ -1066,14 +1070,14 @@ object FRMWallet: TFRMWallet
     end
     object tsMessages: TTabSheet
       Caption = 'Messages'
-      ClientHeight = 461
-      ClientWidth = 861
+      ClientHeight = 440
+      ClientWidth = 857
       ImageIndex = 6
       object Label11: TLabel
         Left = 15
         Height = 13
         Top = 151
-        Width = 59
+        Width = 51
         Caption = 'Messages:'
         ParentColor = False
       end
@@ -1081,7 +1085,7 @@ object FRMWallet: TFRMWallet
         Left = 315
         Height = 13
         Top = 11
-        Width = 99
+        Width = 85
         Caption = 'Message to send:'
         ParentColor = False
       end
@@ -1089,7 +1093,7 @@ object FRMWallet: TFRMWallet
         Left = 15
         Height = 13
         Top = 11
-        Width = 126
+        Width = 107
         Caption = 'Available connections:'
         ParentColor = False
       end
@@ -1097,7 +1101,7 @@ object FRMWallet: TFRMWallet
         Left = 410
         Height = 13
         Top = 11
-        Width = 430
+        Width = 361
         Caption = '(Messages will be encrypted, so only dest connection will be able to read it)'
         Font.Color = clGrayText
         Font.Height = -11
@@ -1114,7 +1118,6 @@ object FRMWallet: TFRMWallet
         MultiSelect = True
         ScrollWidth = 273
         TabOrder = 0
-        TopIndex = -1
       end
       object bbSendAMessage: TButton
         Left = 315
@@ -1127,9 +1130,9 @@ object FRMWallet: TFRMWallet
       end
       object memoMessages: TMemo
         Left = 15
-        Height = 270
+        Height = 249
         Top = 170
-        Width = 825
+        Width = 821
         Anchors = [akTop, akLeft, akRight, akBottom]
         Font.Color = clWindowText
         Font.Height = -16

+ 0 - 2
Units/PascalCoin/UBlockChain.pas

@@ -2199,12 +2199,10 @@ begin
     CT_Op_Changekey : Begin
       OperationResume.newKey := TOpChangeKey(Operation).Data.new_accountkey;
       OperationResume.OperationTxt := 'Change Key to '+TAccountComp.GetECInfoTxt( TOpChangeKey(Operation).Data.new_accountkey.EC_OpenSSL_NID );
-      OperationResume.Fee := TOpChangeKey(Operation).Data.fee;
       Result := true;
     End;
     CT_Op_Recover : Begin
       OperationResume.OperationTxt := 'Recover founds';
-      OperationResume.Fee := TOpRecoverFounds(Operation).Data.fee;
       Result := true;
     End;
   else Exit;

+ 1 - 1
Units/PascalCoin/UConst.pas

@@ -100,7 +100,7 @@ Const
   CT_Op_Changekey = $02;
   CT_Op_Recover = $03;
 
-  CT_ClientAppVersion : AnsiString = {$IFDEF PRODUCTION}'1.5.4'{$ELSE}{$IFDEF TESTNET}'TESTNET 1.5.4'{$ELSE}{$ENDIF}{$ENDIF};
+  CT_ClientAppVersion : AnsiString = {$IFDEF PRODUCTION}'1.5.5'{$ELSE}{$IFDEF TESTNET}'TESTNET 1.5.5'{$ELSE}{$ENDIF}{$ENDIF};
 
   CT_Discover_IPs =  'bpascal1.dynamic-dns.net;bpascal2.dynamic-dns.net;pascalcoin2.ddns.net;pascalcoin1.dynamic-dns.net;pascalcoin1.dns1.us';
 

+ 2 - 1
Units/PascalCoin/UCrypto.pas

@@ -52,7 +52,7 @@ Type
   public
     Constructor Create;
     Procedure GenerateRandomPrivateKey(EC_OpenSSL_NID : Word);
-    Destructor Destroy;
+    Destructor Destroy; override;
     Property PrivateKey : PEC_KEY read FPrivateKey;
     Property PublicKey : TECDSA_Public read GetPublicKey;
     Property PublicKeyPoint : PEC_POINT read GetPublicKeyPoint;
@@ -149,6 +149,7 @@ end;
 destructor TECPrivateKey.Destroy;
 begin
   if Assigned(FPrivateKey) then EC_KEY_free(FPrivateKey);
+  inherited;
 end;
 
 function TECPrivateKey.ExportToRaw: TRawBytes;

+ 7 - 1
Units/PascalCoin/UNetProtocol.pas

@@ -3369,6 +3369,8 @@ end;
 
 procedure TNetworkAdjustedTime.UpdateMedian(list : TList);
 Var last : Integer;
+  i : Integer;
+  s : String;
 begin
   last := FTimeOffset;
   list.Sort(SortPNetworkAdjustedTimeReg);
@@ -3380,8 +3382,12 @@ begin
     FTimeOffset := PNetworkAdjustedTimeReg(list[list.Count DIV 2])^.timeOffset;
   end;
   if (last<>FTimeOffset) then begin
+    s := '';
+    for i := 0 to list.Count - 1 do begin
+      s := s + ',' + IntToStr(PNetworkAdjustedTimeReg(list[i])^.timeOffset);
+    end;
     TLog.NewLog(ltinfo,ClassName,
-      Format('Updated NAT median offset. My offset is now %d (before %d) based on %d/%d connections',[FTimeOffset,last,list.Count,FTotalCounter]));
+      Format('Updated NAT median offset. My offset is now %d (before %d) based on %d/%d connections %s',[FTimeOffset,last,list.Count,FTotalCounter,s]));
   end;
 end;
 

+ 57 - 44
Units/PascalCoin/UNode.pas

@@ -74,7 +74,7 @@ Type
     //
     Procedure NotifyBlocksChanged;
     //
-    procedure GetStoredOperationsFromAccount(const OperationsResume: TOperationsResumeList; account_number: Cardinal; MaxDepth, MaxOperations : Integer);
+    procedure GetStoredOperationsFromAccount(const OperationsResume: TOperationsResumeList; account_number: Cardinal; MaxDepth, StartOperation, EndOperation : Integer);
     Function FindOperation(Const OperationComp : TPCOperationsComp; Const OperationHash : TRawBytes; var block : Cardinal; var operation_block_index : Integer) : Boolean;
     //
     Procedure AutoDiscoverNodes(Const ips : AnsiString);
@@ -594,61 +594,73 @@ begin
   end;
 end;
 
-procedure TNode.GetStoredOperationsFromAccount(const OperationsResume: TOperationsResumeList; account_number: Cardinal; MaxDepth, MaxOperations: Integer);
-  Procedure DoGetFromBlock(block_number : Cardinal; last_balance : Int64; act_depth : Integer);
+procedure TNode.GetStoredOperationsFromAccount(const OperationsResume: TOperationsResumeList; account_number: Cardinal; MaxDepth, StartOperation, EndOperation: Integer);
+  // Optimization:
+  // For better performance, will only include at "OperationsResume" values betweeen "startOperation" and "endOperation"
+  Procedure DoGetFromBlock(block_number : Integer; last_balance : Int64; act_depth : Integer; nOpsCounter : Integer);
   var opc : TPCOperationsComp;
     op : TPCOperation;
     OPR : TOperationResume;
     l : TList;
     i : Integer;
-    next_block_number : Cardinal;
+    last_block_number, next_block_number : Integer;
   begin
-    if (act_depth<=0) Or ((block_number<=0) And (block_number>0)) then exit;
-
+    if (act_depth<=0) then exit;
     opc := TPCOperationsComp.Create(Nil);
     Try
-      If not Bank.Storage.LoadBlockChainBlock(opc,block_number) then begin
-        TLog.NewLog(lterror,ClassName,'Error searching for block '+inttostr(block_number));
-        exit;
-      end;
       l := TList.Create;
       try
-        next_block_number := 0;
-        opc.OperationsHashTree.GetOperationsAffectingAccount(account_number,l);
-        for i := l.Count - 1 downto 0 do begin
-          op := opc.Operation[PtrInt(l.Items[i])];
-          if (i=0) then begin
-            If op.SenderAccount=account_number then next_block_number := op.Previous_Sender_updated_block
-            else next_block_number := op.Previous_Destination_updated_block;
+        last_block_number := block_number+1;
+        while (last_block_number>block_number) And (act_depth>0)
+          And (block_number >= (account_number DIV CT_AccountsPerBlock))
+          And (nOpsCounter <= EndOperation) do begin
+          last_block_number := block_number;
+          next_block_number := 0;
+          l.Clear;
+          If not Bank.Storage.LoadBlockChainBlock(opc,block_number) then begin
+            TLog.NewLog(lterror,ClassName,'Error searching for block '+inttostr(block_number));
+            exit;
           end;
-          If TPCOperation.OperationToOperationResume(block_number,Op,account_number,OPR) then begin
-            OPR.NOpInsideBlock := Op.tag; // Note: Used Op.tag to include operation index inside a list
-            OPR.time := opc.OperationBlock.timestamp;
+          opc.OperationsHashTree.GetOperationsAffectingAccount(account_number,l);
+          for i := l.Count - 1 downto 0 do begin
+            op := opc.Operation[PtrInt(l.Items[i])];
+            if (i=0) then begin
+              If op.SenderAccount=account_number then next_block_number := op.Previous_Sender_updated_block
+              else next_block_number := op.Previous_Destination_updated_block;
+            end;
+            If TPCOperation.OperationToOperationResume(block_number,Op,account_number,OPR) then begin
+              OPR.NOpInsideBlock := Op.tag; // Note: Used Op.tag to include operation index inside a list
+              OPR.time := opc.OperationBlock.timestamp;
+              OPR.Block := block_number;
+              OPR.Balance := last_balance;
+              last_balance := last_balance - ( OPR.Amount + OPR.Fee );
+              if (nOpsCounter>=StartOperation) And (nOpsCounter<=EndOperation) then begin
+                OperationsResume.Add(OPR);
+              end;
+              inc(nOpsCounter);
+            end;
+          end;
+          // Is a new block operation?
+          if (TAccountComp.AccountBlock(account_number)=block_number) And ((account_number MOD CT_AccountsPerBlock)=0) then begin
+            OPR := CT_TOperationResume_NUL;
+            OPR.valid := true;
             OPR.Block := block_number;
+            OPR.time := opc.OperationBlock.timestamp;
+            OPR.AffectedAccount := account_number;
+            OPR.Amount := opc.OperationBlock.reward;
+            OPR.Fee := opc.OperationBlock.fee;
             OPR.Balance := last_balance;
-            last_balance := last_balance - ( OPR.Amount + OPR.Fee );
-            OperationsResume.Add(OPR);
+            OPR.OperationTxt := 'Blockchain reward';
+            if (nOpsCounter>=StartOperation) And (nOpsCounter<=EndOperation) then begin
+              OperationsResume.Add(OPR);
+            end;
+            inc(nOpsCounter);
           end;
+          //
+          opc.Clear(true);
+          dec(act_depth);
+          block_number := next_block_number;
         end;
-        // Is a new block operation?
-        if (TAccountComp.AccountBlock(account_number)=block_number) And ((account_number MOD CT_AccountsPerBlock)=0) then begin
-          OPR := CT_TOperationResume_NUL;
-          OPR.valid := true;
-          OPR.Block := block_number;
-          OPR.time := opc.OperationBlock.timestamp;
-          OPR.AffectedAccount := account_number;
-          OPR.Amount := opc.OperationBlock.reward;
-          OPR.Fee := opc.OperationBlock.fee;
-          OPR.Balance := last_balance;
-          OPR.OperationTxt := 'Blockchain reward';
-          OperationsResume.Add(OPR);
-        end;
-        //
-        opc.Clear(true);
-        if (next_block_number>=0) And (next_block_number<block_number) And (act_depth>0)
-           And (next_block_number >= (account_number DIV CT_AccountsPerBlock))
-           And ((OperationsResume.Count<MaxOperations) Or (MaxOperations<=0))
-           then DoGetFromBlock(next_block_number,last_balance,act_depth-1);
       finally
         l.Free;
       end;
@@ -659,10 +671,11 @@ procedure TNode.GetStoredOperationsFromAccount(const OperationsResume: TOperatio
 
 Var acc : TAccount;
 begin
-  if MaxDepth<0 then exit;
-  if account_number>=Bank.SafeBox.AccountsCount then exit;
+  if MaxDepth<0 then Exit;
+  if account_number>=Bank.SafeBox.AccountsCount then Exit;
+  if StartOperation>EndOperation then Exit;
   acc := Bank.SafeBox.Account(account_number);
-  if (acc.updated_block>0) Or (acc.account=0) then DoGetFromBlock(acc.updated_block,acc.balance,MaxDepth);
+  if (acc.updated_block>0) Or (acc.account=0) then DoGetFromBlock(acc.updated_block,acc.balance,MaxDepth,0);
 end;
 
 function TNode.FindOperation(const OperationComp: TPCOperationsComp;

+ 39 - 27
Units/PascalCoin/URPC.pas

@@ -19,7 +19,7 @@ unit URPC;
 
 interface
 
-Uses UThread, ULog, UConst, UNode, UAccounts, UCrypto, UBlockChain,
+Uses UThread, ULog, UConst, UNode, UAccounts, UCrypto, UBlockChain, Math,
   UNetProtocol, UOpTransaction, UWalletKeys, UTime, UAES, UECIES,
   UJSONFunctions, classes, blcksock, synsock, IniFiles, Variants;
 
@@ -409,7 +409,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
 
   Function ToJSONCurrency(pascalCoins : Int64) : Real;
   Begin
-    Result := pascalCoins / 10000;
+    Result := RoundTo( pascalCoins / 10000 , -4);
   End;
 
   Function ToPascalCoins(jsonCurr : Real) : Int64;
@@ -538,48 +538,60 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     jsonObject.GetAsVariant('rawoperations').Value:=OperationsHashTreeToHexaString(OperationsHashTree);
   End;
 
-  Function GetAccountOperations(AccountNumber : Cardinal; jsonArray : TPCJSONArray; MaxBlocksDepht,start,max : Integer) : Boolean;
+  Function GetAccountOperations(accountNumber : Cardinal; jsonArray : TPCJSONArray; maxBlocksDepth, startReg, maxReg: Integer) : Boolean;
   var list : TList;
     Op : TPCOperation;
     OPR : TOperationResume;
     Obj : TPCJSONObject;
     OperationsResume : TOperationsResumeList;
-    i : Integer;
+    i, nCounter : Integer;
   Begin
+    Result := false;
+    if (startReg<-1) or (maxReg<=0) then begin
+      ErrorNum := CT_RPC_ErrNum_InvalidData;
+      ErrorDesc := 'Invalid start or max value';
+      Exit;
+    end;
+    nCounter := 0;
     OperationsResume := TOperationsResumeList.Create;
     try
-      list := TList.Create;
-      Try
-        FNode.Operations.OperationsHashTree.GetOperationsAffectingAccount(AccountNumber,list);
-        for i := list.Count - 1 downto 0 do begin
-          Op := FNode.Operations.OperationsHashTree.GetOperation(PtrInt(list[i]));
-          If TPCOperation.OperationToOperationResume(0,Op,AccountNumber,OPR) then begin
-            OPR.NOpInsideBlock := i;
-            OPR.Block := FNode.Operations.OperationBlock.block;
-            OPR.Balance := FNode.Operations.SafeBoxTransaction.Account(AccountNumber).balance;
-            OperationsResume.Add(OPR);
+      if (startReg=-1) then begin
+        // 1.5.5 change: If start=-1 then will include PENDING OPERATIONS, otherwise not.
+        // Only will return pending operations if start=0, otherwise
+        list := TList.Create;
+        Try
+          FNode.Operations.OperationsHashTree.GetOperationsAffectingAccount(accountNumber,list);
+          for i := list.Count - 1 downto 0 do begin
+            Op := FNode.Operations.OperationsHashTree.GetOperation(PtrInt(list[i]));
+            If TPCOperation.OperationToOperationResume(0,Op,accountNumber,OPR) then begin
+              OPR.NOpInsideBlock := i;
+              OPR.Block := FNode.Operations.OperationBlock.block;
+              OPR.Balance := FNode.Operations.SafeBoxTransaction.Account(accountNumber).balance;
+              if (nCounter>=startReg) And (nCounter<maxReg) then begin
+                OperationsResume.Add(OPR);
+              end;
+              inc(nCounter);
+            end;
           end;
-        end;
-      Finally
-        list.Free;
-      End;
-      if ((max<=0) Or (OperationsResume.Count<(max+start))) then begin
-        FNode.GetStoredOperationsFromAccount(OperationsResume,AccountNumber,MaxBlocksDepht,max+start);
+        Finally
+          list.Free;
+        End;
+      end;
+      if (nCounter<maxReg) then begin
+        if (startReg<0) then startReg := 0; // Prevent -1 value
+        FNode.GetStoredOperationsFromAccount(OperationsResume,accountNumber,maxBlocksDepth,startReg,startReg+maxReg-1);
       end;
-      //
       for i:=0 to OperationsResume.Count-1 do begin
-        if (i>=start) then begin
-          Obj := jsonArray.GetAsObject(jsonArray.Count);
-          OPR := OperationsResume[i];
-          FillOperationResumeToJSONObject(OPR,Obj);
-          if ((max>0) And (jsonArray.Count>=max)) then break; // stop
-        end;
+        Obj := jsonArray.GetAsObject(jsonArray.Count);
+        OPR := OperationsResume[i];
+        FillOperationResumeToJSONObject(OPR,Obj);
       end;
       Result := True;
     finally
       OperationsResume.Free;
     end;
   end;
+
   Procedure GetConnections;
   var i : Integer;
     l : TList;

+ 1 - 1
Units/Utils/UGridUtils.pas

@@ -874,7 +874,7 @@ begin
         Finally
           list.Free;
         End;
-        Node.GetStoredOperationsFromAccount(FOperationsResume,AccountNumber,100,5000);
+        Node.GetStoredOperationsFromAccount(FOperationsResume,AccountNumber,100,0,5000);
       end;
     end;
   Finally