Sfoglia il codice sorgente

Lazarus GUI updates adding latests core updates of Atomi Swaps. Also some Delphi bugs fixed

PascalCoin 6 anni fa
parent
commit
c7140e7001

+ 113 - 0
src/gui-classic/UFRMHashLock.lfm

@@ -0,0 +1,113 @@
+object FRMHashLock: TFRMHashLock
+  Left = 237
+  Height = 270
+  Top = 179
+  Width = 548
+  BorderStyle = bsDialog
+  Caption = 'Atomic Swap Hash-Lock '
+  ClientHeight = 270
+  ClientWidth = 548
+  Color = clBtnFace
+  Font.Color = clWindowText
+  Font.Height = -11
+  Font.Name = 'Tahoma'
+  OnCloseQuery = FormCloseQuery
+  OnCreate = FormCreate
+  Position = poOwnerFormCenter
+  LCLVersion = '1.8.0.6'
+  object lblError: TLabel
+    Left = 19
+    Height = 13
+    Top = 239
+    Width = 282
+    AutoSize = False
+    Caption = 'Errors detected'
+    Color = clBtnFace
+    Font.Color = clRed
+    Font.Height = -11
+    Font.Name = 'Tahoma'
+    ParentColor = False
+    ParentFont = False
+    Transparent = False
+  end
+  object btnCancel: TBitBtn
+    Left = 424
+    Height = 31
+    Top = 231
+    Width = 116
+    Anchors = [akRight, akBottom]
+    Kind = bkCancel
+    ModalResult = 2
+    OnClick = btnCancelClick
+    TabOrder = 0
+  end
+  object btnSet: TBitBtn
+    Left = 307
+    Height = 31
+    Top = 231
+    Width = 111
+    Anchors = [akRight, akBottom]
+    Caption = 'Set Hash-Lock'
+    Kind = bkOK
+    ModalResult = 1
+    OnClick = btnSetClick
+    TabOrder = 1
+  end
+  object GroupBox1: TGroupBox
+    Left = 8
+    Height = 83
+    Top = 14
+    Width = 532
+    Caption = 'Mode'
+    ClientHeight = 65
+    ClientWidth = 528
+    TabOrder = 2
+    object rbHashLock: TRadioButton
+      Left = 11
+      Height = 19
+      Top = 8
+      Width = 362
+      Caption = 'Hash-Lock - the 32 byte hash-lock provided to you by the counterparty'
+      TabOrder = 0
+    end
+    object rbHashLockKey: TRadioButton
+      Left = 11
+      Height = 19
+      Top = 31
+      Width = 386
+      Caption = 'Hash-Lock Key - a secret that will be hashed to create the 32 byte hash-lock'
+      TabOrder = 1
+    end
+  end
+  object GroupBox2: TGroupBox
+    Left = 8
+    Height = 122
+    Top = 103
+    Width = 532
+    Caption = 'Data'
+    ClientHeight = 104
+    ClientWidth = 528
+    TabOrder = 3
+    object Label2: TLabel
+      Left = 11
+      Height = 13
+      Top = 21
+      Width = 266
+      Caption = 'Please enter the hash lock data as a hexadecimal string'
+      ParentColor = False
+    end
+    object meHashLockData: TMemo
+      Left = 11
+      Height = 49
+      Top = 40
+      Width = 501
+      Anchors = [akTop, akLeft, akRight, akBottom]
+      Font.Color = clBlack
+      Font.Height = -16
+      Font.Name = 'Tahoma'
+      ParentFont = False
+      TabOrder = 0
+      WantReturns = False
+    end
+  end
+end

+ 11 - 2
src/gui-classic/UFRMHashLock.pas

@@ -42,7 +42,12 @@ implementation
 
 uses UCrypto, UAccounts;
 
-{$R *.dfm}
+{$IFnDEF FPC}
+  {$R *.dfm}
+{$ELSE}
+  {$R *.lfm}
+{$ENDIF}
+
 
 procedure TFRMHashLock.btnCancelClick(Sender: TObject);
 begin
@@ -54,6 +59,7 @@ var
   LData : TRawBytes;
   LErr : string;
 begin
+  Try
   Error := '';
   if (NOT rbHashLock.Checked) AND (NOT rbHashLockKey.Checked) then begin
     Error := 'Select the hash-lock mode';
@@ -80,11 +86,14 @@ begin
     end;
     FHashLock := TAccountComp.CalculateHashLock(LData);
   end else Error := 'INTERNAL ERROR: 8356DE573BA748618EDD6603B22D9EAD';
+  Finally
+    if Error='' then ModalResult := MrOk;
+  end;
 end;
 
 procedure TFRMHashLock.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
 begin
-  CanClose := Error = '';
+  //
 end;
 
 procedure TFRMHashLock.FormCreate(Sender: TObject);

+ 33 - 1
src/gui-classic/UFRMOperation.dfm

@@ -105,6 +105,10 @@ object FRMOperation: TFRMOperation
     TabOrder = 1
     object tsOperation: TTabSheet
       TabVisible = False
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object lblFee: TLabel
         Left = 15
         Top = 220
@@ -300,6 +304,10 @@ object FRMOperation: TFRMOperation
         OnChange = PageControlOpTypeChange
         object tsTransaction: TTabSheet
           Caption = 'Transaction'
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblDestAccount: TLabel
             Left = 13
             Top = 32
@@ -386,6 +394,10 @@ object FRMOperation: TFRMOperation
         object tsChangePrivateKey: TTabSheet
           Caption = 'Change Key'
           ImageIndex = 1
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblNewPrivateKey: TLabel
             Left = 57
             Top = 40
@@ -525,6 +537,10 @@ object FRMOperation: TFRMOperation
         object tsListAccount: TTabSheet
           Caption = 'List Account'
           ImageIndex = 3
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblListAccountErrors: TLabel
             Left = 11
             Top = 7
@@ -769,6 +785,10 @@ object FRMOperation: TFRMOperation
         object tsDelistAccount: TTabSheet
           Caption = 'Delist Account'
           ImageIndex = 3
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblDelistErrors: TLabel
             Left = 13
             Top = 10
@@ -789,6 +809,10 @@ object FRMOperation: TFRMOperation
         object tsBuyAccount: TTabSheet
           Caption = 'Buy Account'
           ImageIndex = 4
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblAccountToBuy: TLabel
             Left = 13
             Top = 32
@@ -964,6 +988,10 @@ object FRMOperation: TFRMOperation
         end
         object tsChangeInfo: TTabSheet
           Caption = 'Change Info'
+          ExplicitLeft = 0
+          ExplicitTop = 0
+          ExplicitWidth = 0
+          ExplicitHeight = 0
           object lblChangeInfoErrors: TLabel
             Left = 13
             Top = 10
@@ -1032,7 +1060,7 @@ object FRMOperation: TFRMOperation
           object ebChangeAccountData: TEdit
             Left = 118
             Top = 84
-            Width = 258
+            Width = 386
             Height = 21
             TabOrder = 2
             TextHint = 'Hexadecimal value (0..32 bytes)'
@@ -1050,6 +1078,10 @@ object FRMOperation: TFRMOperation
     object tsGlobalError: TTabSheet
       ImageIndex = 1
       TabVisible = False
+      ExplicitLeft = 0
+      ExplicitTop = 0
+      ExplicitWidth = 0
+      ExplicitHeight = 0
       object lblGlobalErrors: TLabel
         Left = 40
         Top = 50

+ 412 - 294
src/gui-classic/UFRMOperation.lfm

@@ -1,12 +1,12 @@
 object FRMOperation: TFRMOperation
-  Left = 772
-  Height = 493
-  Top = 245
+  Left = 564
+  Height = 513
+  Top = 267
   Width = 608
   BorderIcons = [biSystemMenu]
   BorderStyle = bsSingle
   Caption = 'New Operation'
-  ClientHeight = 493
+  ClientHeight = 513
   ClientWidth = 608
   Color = clBtnFace
   Font.Color = clWindowText
@@ -15,8 +15,7 @@ object FRMOperation: TFRMOperation
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   Position = poOwnerFormCenter
-  LCLVersion = '1.8.4.0'
-  Visible = False
+  LCLVersion = '1.8.0.6'
   object lblAccountCaption: TLabel
     Left = 25
     Height = 13
@@ -57,7 +56,7 @@ object FRMOperation: TFRMOperation
   object bbExecute: TBitBtn
     Left = 300
     Height = 31
-    Top = 445
+    Top = 464
     Width = 130
     Caption = 'Execute (F12)'
     Glyph.Data = {
@@ -85,7 +84,7 @@ object FRMOperation: TFRMOperation
   object bbCancel: TBitBtn
     Left = 465
     Height = 31
-    Top = 445
+    Top = 464
     Width = 116
     Cancel = True
     Caption = 'Cancel'
@@ -95,7 +94,7 @@ object FRMOperation: TFRMOperation
   end
   object PageControlLocked: TPageControl
     Left = 25
-    Height = 367
+    Height = 383
     Top = 72
     Width = 556
     ActivePage = tsOperation
@@ -103,7 +102,7 @@ object FRMOperation: TFRMOperation
     TabOrder = 1
     object tsOperation: TTabSheet
       Caption = 'Operation'
-      ClientHeight = 341
+      ClientHeight = 357
       ClientWidth = 548
       TabVisible = False
       object lblFee: TLabel
@@ -116,11 +115,11 @@ object FRMOperation: TFRMOperation
       end
       object gbPayload: TGroupBox
         Left = 13
-        Height = 129
+        Height = 145
         Top = 207
         Width = 521
         Caption = ' Payload: '
-        ClientHeight = 111
+        ClientHeight = 127
         ClientWidth = 517
         TabOrder = 2
         object lblEncryptPassword: TLabel
@@ -141,9 +140,9 @@ object FRMOperation: TFRMOperation
         end
         object lblEncryptionErrors: TLabel
           Left = 255
-          Height = 13
+          Height = 33
           Top = 87
-          Width = 246
+          Width = 182
           AutoSize = False
           Caption = 'Errors detected'
           Font.Color = clRed
@@ -151,6 +150,7 @@ object FRMOperation: TFRMOperation
           Font.Name = 'Tahoma'
           ParentColor = False
           ParentFont = False
+          WordWrap = True
         end
         object lblPayloadLength: TLabel
           Left = 352
@@ -223,6 +223,14 @@ object FRMOperation: TFRMOperation
           OnClick = memoPayloadClick
           TabOrder = 0
         end
+        object cbPayloadAsHex: TCheckBox
+          Left = 444
+          Height = 19
+          Top = 92
+          Width = 54
+          Caption = 'As Hex'
+          TabOrder = 6
+        end
       end
       object ebFee: TEdit
         Left = 90
@@ -232,12 +240,12 @@ object FRMOperation: TFRMOperation
         TabOrder = 1
       end
       object PageControlOpType: TPageControl
-        Left = 15
+        Left = 16
         Height = 167
         Top = 11
         Width = 521
-        ActivePage = tsChangeInfo
-        TabIndex = 5
+        ActivePage = tsListAccount
+        TabIndex = 2
         TabOrder = 0
         OnChange = PageControlOpTypeChange
         object tsTransaction: TTabSheet
@@ -328,285 +336,375 @@ object FRMOperation: TFRMOperation
           ClientHeight = 141
           ClientWidth = 513
           ImageIndex = 1
-          object gbChangeKey: TGroupBox
-            Left = 7
-            Height = 130
-            Top = 6
-            Width = 488
-            Caption = ' Change type: '
-            ClientHeight = 112
-            ClientWidth = 484
+          object lblNewPrivateKey: TLabel
+            Left = 61
+            Height = 13
+            Top = 41
+            Width = 78
+            Caption = 'New private key'
+            ParentColor = False
+          end
+          object lblNewOwnerPublicKey: TLabel
+            Left = 28
+            Height = 13
+            Top = 91
+            Width = 109
+            Caption = 'New owners public key'
+            ParentColor = False
+          end
+          object lblNewOwnerErrors: TLabel
+            Left = 177
+            Height = 13
+            Top = 69
+            Width = 302
+            Alignment = taRightJustify
+            AutoSize = False
+            Caption = 'Errors detected'
+            Font.Color = clRed
+            Font.Height = -11
+            Font.Name = 'Tahoma'
+            ParentColor = False
+            ParentFont = False
+          end
+          object lblChangeKeyErrors: TLabel
+            Left = 149
+            Height = 13
+            Top = 16
+            Width = 331
+            Alignment = taRightJustify
+            AutoSize = False
+            Caption = 'Errors detected'
+            Font.Color = clRed
+            Font.Height = -11
+            Font.Name = 'Tahoma'
+            ParentColor = False
+            ParentFont = False
+          end
+          object rbChangeKeyWithAnother: TRadioButton
+            Left = 16
+            Height = 19
+            Top = 21
+            Width = 114
+            Caption = 'Change private key'
             TabOrder = 0
-            object lblNewPrivateKey: TLabel
-              Left = 57
-              Height = 13
-              Top = 33
-              Width = 78
-              Caption = 'New private key'
-              ParentColor = False
-            end
-            object lblNewOwnerPublicKey: TLabel
-              Left = 24
-              Height = 13
-              Top = 83
-              Width = 109
-              Caption = 'New owners public key'
-              ParentColor = False
-            end
-            object lblNewOwnerErrors: TLabel
-              Left = 173
-              Height = 13
-              Top = 61
-              Width = 302
-              Alignment = taRightJustify
-              AutoSize = False
-              Caption = 'Errors detected'
-              Font.Color = clRed
-              Font.Height = -11
-              Font.Name = 'Tahoma'
-              ParentColor = False
-              ParentFont = False
-            end
-            object lblChangeKeyErrors: TLabel
-              Left = 145
-              Height = 13
-              Top = 8
-              Width = 331
-              Alignment = taRightJustify
-              AutoSize = False
-              Caption = 'Errors detected'
-              Font.Color = clRed
-              Font.Height = -11
-              Font.Name = 'Tahoma'
-              ParentColor = False
-              ParentFont = False
-            end
-            object rbChangeKeyWithAnother: TRadioButton
-              Left = 12
-              Height = 19
-              Top = 13
-              Width = 114
-              Caption = 'Change private key'
-              TabOrder = 0
-            end
-            object cbNewPrivateKey: TComboBox
-              Left = 145
-              Height = 21
-              Top = 30
-              Width = 294
-              ItemHeight = 13
-              Sorted = True
-              Style = csDropDownList
-              TabOrder = 1
-            end
-            object ebNewPublicKey: TEdit
-              Left = 144
-              Height = 21
-              Top = 80
-              Width = 331
-              TabOrder = 4
-            end
-            object bbChangePrivateKeyKeys: TBitBtn
-              Left = 445
-              Height = 22
-              Top = 29
-              Width = 31
-              Glyph.Data = {
-                36050000424D3605000000000000360400002800000010000000100000000100
-                0800000000000001000000000000000000000001000000010000FF00FF008C6B
-                6C0087707000AE877C000D7FA9006F7C88006D7C94001F7ECE000E80AA001180
-                A7001081AB00048CB900078DBC000B8DBA000C8DBA00088EBC001285B0007882
-                95006092BD005EA8BE000A91C1000F9DCE002087DE0011A7D10030BCDC001F89
-                E00059A9DC0044BADD004ABFE00057AEF4004DB1F90049B2FF004EB7FF0057B1
-                F60050B6FE0022D7FC0024D7FF0024D8FD0039D7FB0035D8FD004BC6DC0046C6
-                E40048D5EE0075D3E90058E9FD006FE6FF0070E6FF0071F9FE007BFFFF008683
-                88008B8697008F989B00969594009C919000AD858000AD868500AB939500A49E
-                9900B1979400B5A09F008AA5AD00CAA08C00CDAC9300C2A69A00F3BE8000C6AE
-                A000CFB7A100D3BBA200F4C88E00F5CB9A00F5D09C00F8D09800DAC5B700E4CC
-                A900EFD2A900ECD1AC00F6DAAB00F5DEB500F5E1B600F9E1B100FEEAB900FFF2
-                BA00A1C6C8008DE6FA0081F8FE008CFAFD008DFCFE0097FCFD009BFBFD00B8ED
-                F600A7FFFF00AAFFFE00ADFFFE00B6F6FF00B1FCFD00B4FFFF00ECDDCC00E8DD
-                D600FFF7C600FCF5CD00FCF7D100FAF6D600FFFBD500FEFED600F7F2D900FEFF
-                D900FFFEDD00C6F5FF00C6FEFF00D2FFFF00FEF7E000FBFCE100FDFFE100FFFF
-                E400E3FEFF00F9F6F200FFFFF400F1FBFC00F5FFFE00FBFFFF00000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                0000000000000000000000000000000000000000000000000000000000000000
-                00000000000000000605000004080408080A000000000011191A000B2A23272D
-                531B080000001116201D0B552C23272E531C1509003207201D000F552C23272B
-                3A3F41030112202000000F552C252938606771684236200000000B5F5D6B3B61
-                74676A67513D000000000B59181735716A676A63474B360000000F282C23396A
-                6A6A6A4C404D360000000B552C2534656A654F455049360000000B552C251343
-                6247446E7336000000000B552C25263C3E4B4E483636000000000F55542F3057
-                523331020000000000000B77766D5F5C5C5C2F08000000000000001476726C5C
-                5A58100000000000000000000F0F0B0F0F0F0000000000000000
-              }
-              OnClick = bbChangePrivateKeyKeysClick
-              TabOrder = 2
-            end
-            object rbChangeKeyTransferAccountToNewOwner: TRadioButton
-              Left = 12
-              Height = 19
-              Top = 60
-              Width = 180
-              Caption = 'Transfer account to a new owner'
-              TabOrder = 3
-            end
+          end
+          object cbNewPrivateKey: TComboBox
+            Left = 149
+            Height = 21
+            Top = 38
+            Width = 294
+            ItemHeight = 13
+            Sorted = True
+            Style = csDropDownList
+            TabOrder = 1
+          end
+          object ebNewPublicKey: TEdit
+            Left = 148
+            Height = 21
+            Top = 88
+            Width = 331
+            TabOrder = 2
+          end
+          object bbChangePrivateKeyKeys: TBitBtn
+            Left = 449
+            Height = 22
+            Top = 37
+            Width = 31
+            Glyph.Data = {
+              36050000424D3605000000000000360400002800000010000000100000000100
+              0800000000000001000000000000000000000001000000010000FF00FF008C6B
+              6C0087707000AE877C000D7FA9006F7C88006D7C94001F7ECE000E80AA001180
+              A7001081AB00048CB900078DBC000B8DBA000C8DBA00088EBC001285B0007882
+              95006092BD005EA8BE000A91C1000F9DCE002087DE0011A7D10030BCDC001F89
+              E00059A9DC0044BADD004ABFE00057AEF4004DB1F90049B2FF004EB7FF0057B1
+              F60050B6FE0022D7FC0024D7FF0024D8FD0039D7FB0035D8FD004BC6DC0046C6
+              E40048D5EE0075D3E90058E9FD006FE6FF0070E6FF0071F9FE007BFFFF008683
+              88008B8697008F989B00969594009C919000AD858000AD868500AB939500A49E
+              9900B1979400B5A09F008AA5AD00CAA08C00CDAC9300C2A69A00F3BE8000C6AE
+              A000CFB7A100D3BBA200F4C88E00F5CB9A00F5D09C00F8D09800DAC5B700E4CC
+              A900EFD2A900ECD1AC00F6DAAB00F5DEB500F5E1B600F9E1B100FEEAB900FFF2
+              BA00A1C6C8008DE6FA0081F8FE008CFAFD008DFCFE0097FCFD009BFBFD00B8ED
+              F600A7FFFF00AAFFFE00ADFFFE00B6F6FF00B1FCFD00B4FFFF00ECDDCC00E8DD
+              D600FFF7C600FCF5CD00FCF7D100FAF6D600FFFBD500FEFED600F7F2D900FEFF
+              D900FFFEDD00C6F5FF00C6FEFF00D2FFFF00FEF7E000FBFCE100FDFFE100FFFF
+              E400E3FEFF00F9F6F200FFFFF400F1FBFC00F5FFFE00FBFFFF00000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              0000000000000000000000000000000000000000000000000000000000000000
+              00000000000000000605000004080408080A000000000011191A000B2A23272D
+              531B080000001116201D0B552C23272E531C1509003207201D000F552C23272B
+              3A3F41030112202000000F552C252938606771684236200000000B5F5D6B3B61
+              74676A67513D000000000B59181735716A676A63474B360000000F282C23396A
+              6A6A6A4C404D360000000B552C2534656A654F455049360000000B552C251343
+              6247446E7336000000000B552C25263C3E4B4E483636000000000F55542F3057
+              523331020000000000000B77766D5F5C5C5C2F08000000000000001476726C5C
+              5A58100000000000000000000F0F0B0F0F0F0000000000000000
+            }
+            OnClick = bbChangePrivateKeyKeysClick
+            TabOrder = 3
+          end
+          object rbChangeKeyTransferAccountToNewOwner: TRadioButton
+            Left = 16
+            Height = 19
+            Top = 68
+            Width = 180
+            Caption = 'Transfer account to a new owner'
+            TabOrder = 4
           end
         end
-        object tsListForSale: TTabSheet
-          Caption = 'List account for sale'
+        object tsListAccount: TTabSheet
+          Caption = 'List Account'
           ClientHeight = 141
           ClientWidth = 513
           ImageIndex = 3
-          object gbSaleType: TGroupBox
-            Left = 8
-            Height = 135
-            Top = 5
-            Width = 499
-            Caption = ' Sale type: '
-            ClientHeight = 117
-            ClientWidth = 495
+          object lblPrice: TLabel
+            Left = 38
+            Height = 13
+            Top = 68
+            Width = 50
+            Alignment = taRightJustify
+            Caption = 'Sale price:'
+            ParentColor = False
+          end
+          object lblSeller: TLabel
+            Left = 200
+            Height = 13
+            Top = 68
+            Width = 136
+            Alignment = taRightJustify
+            AutoSize = False
+            Caption = 'Seller Account'
+            ParentColor = False
+          end
+          object lblNewKey: TLabel
+            Left = 39
+            Height = 13
+            Top = 91
+            Width = 49
+            Alignment = taRightJustify
+            Caption = 'Buyer Key'
+            ParentColor = False
+          end
+          object lblTimeLock: TLabel
+            Left = 41
+            Height = 13
+            Top = 115
+            Width = 47
+            Alignment = taRightJustify
+            Caption = 'Time-Lock'
+            ParentColor = False
+          end
+          object lblListAccountErrors: TLabel
+            Left = 16
+            Height = 13
+            Top = 8
+            Width = 483
+            AutoSize = False
+            Caption = 'Errors detected'
+            Font.Color = clRed
+            Font.Height = -11
+            Font.Name = 'Tahoma'
+            ParentColor = False
+            ParentFont = False
+          end
+          object rbListAccountForPublicSale: TRadioButton
+            Left = 16
+            Height = 19
+            Top = 26
+            Width = 106
+            Caption = 'List for Public Sale'
             TabOrder = 0
-            object Label1: TLabel
-              Left = 81
-              Height = 13
-              Top = 44
-              Width = 50
-              Caption = 'Sale price:'
-              ParentColor = False
-            end
-            object Label3: TLabel
-              Left = 229
-              Height = 13
-              Top = 44
-              Width = 142
-              Caption = 'Seller account (where to pay)'
-              ParentColor = False
-            end
-            object lblSaleNewOwnerPublicKey: TLabel
-              Left = 20
-              Height = 13
-              Top = 67
-              Width = 109
-              Caption = 'New owners public key'
-              ParentColor = False
-            end
-            object lblSaleLockedUntilBlock: TLabel
-              Left = 44
-              Height = 13
-              Top = 91
-              Width = 87
-              Caption = 'Locked until block:'
-              ParentColor = False
-            end
-            object lblListAccountErrors: TLabel
-              Left = 145
-              Height = 13
-              Top = 0
-              Width = 331
-              Alignment = taRightJustify
-              AutoSize = False
-              Caption = 'Errors detected'
-              Font.Color = clRed
-              Font.Height = -11
-              Font.Name = 'Tahoma'
-              ParentColor = False
-              ParentFont = False
-            end
-            object rbListAccountForPublicSale: TRadioButton
-              Left = 10
-              Height = 19
-              Top = 2
-              Width = 146
-              Caption = 'List account for public sale'
-              TabOrder = 0
-            end
-            object rbListAccountForPrivateSale: TRadioButton
-              Left = 10
-              Height = 19
-              Top = 22
-              Width = 153
-              Caption = 'List account for private sale'
-              TabOrder = 1
-            end
-            object ebSalePrice: TEdit
-              Left = 137
-              Height = 21
-              Top = 41
-              Width = 86
-              TabOrder = 2
-            end
-            object ebSellerAccount: TEdit
-              Left = 378
-              Height = 21
-              Top = 41
-              Width = 82
-              TabOrder = 3
-            end
-            object ebSaleNewOwnerPublicKey: TEdit
-              Left = 137
-              Height = 21
-              Top = 64
-              Width = 323
-              TabOrder = 4
-            end
-            object ebSaleLockedUntilBlock: TEdit
-              Left = 137
-              Height = 21
-              Top = 88
-              Width = 86
-              TabOrder = 5
-            end
-            object sbSearchListerSellerAccount: TSpeedButton
-              Left = 464
-              Height = 22
-              Top = 41
-              Width = 23
-              Glyph.Data = {
-                36030000424D3803000000000000360000002800000010000000100000000100
-                18000000000000000000120B0000120B00000000000000000000FF00FF4A667C
-                BE9596FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
-                FFFF00FFFF00FFFF00FF6B9CC31E89E84B7AA3C89693FF00FFFF00FFFF00FFFF
-                00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF4BB4FE51B5FF
-                2089E94B7AA2C69592FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
-                FFFF00FFFF00FFFF00FFFF00FF51B7FE51B3FF1D87E64E7AA0CA9792FF00FFFF
-                00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
-                51B7FE4EB2FF1F89E64E7BA2B99497FF00FFFF00FFFF00FFFF00FFFF00FFFF00
-                FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF52B8FE4BB1FF2787D95F6A76FF
-                00FFB0857FC09F94C09F96BC988EFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
-                FF00FFFF00FF55BDFFB5D6EDBF9D92BB9B8CE7DAC2FFFFE3FFFFE5FDFADAD8C3
-                B3B58D85FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFCEA795FD
-                EEBEFFFFD8FFFFDAFFFFDBFFFFE6FFFFFBEADDDCAE837FFF00FFFF00FFFF00FF
-                FF00FFFF00FFFF00FFFF00FFC1A091FBDCA8FEF7D0FFFFDBFFFFE3FFFFF8FFFF
-                FDFFFFFDC6A99CFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFC1A091FEE3ACF1
-                C491FCF2CAFFFFDDFFFFE4FFFFF7FFFFF7FFFFE9EEE5CBB9948CFF00FFFF00FF
-                FF00FFFF00FFFF00FFC2A191FFE6AEEEB581F7DCAEFEFDD8FFFFDFFFFFE3FFFF
-                E4FFFFE0F3ECD2BB968EFF00FFFF00FFFF00FFFF00FFFF00FFBC978CFBE7B7F4
-                C791F2C994F8E5B9FEFCD8FFFFDDFFFFDCFFFFE0E2D2BAB68E86FF00FFFF00FF
-                FF00FFFF00FFFF00FFFF00FFD9C3A9FFFEE5F7DCB8F2C994F5D4A5FAE8BDFDF4
-                C9FDFBD6B69089FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB58D85E8
-                DEDDFFFEF2F9D8A3F4C48CF9D49FFDEAB8D0B49FB89086FF00FFFF00FFFF00FF
-                FF00FFFF00FFFF00FFFF00FFFF00FFAD827FC9AA9EEFE0B7EFDFB2E7CEACB890
-                86B89086FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
-                00FFFF00FFBA968ABB988CB79188FF00FFFF00FFFF00FFFF00FF
-              }
-              OnClick = sbSearchListerSellerAccountClick
-            end
+          end
+          object rbListAccountForPrivateSale: TRadioButton
+            Left = 16
+            Height = 19
+            Top = 46
+            Width = 113
+            Caption = 'List for Private Sale'
+            TabOrder = 1
+          end
+          object ebPrice: TEdit
+            Left = 96
+            Height = 21
+            Top = 65
+            Width = 94
+            TabOrder = 4
+            TextHint = 'PASC Quantity'
+          end
+          object ebSellerAccount: TEdit
+            Left = 344
+            Height = 21
+            Top = 65
+            Width = 122
+            TabOrder = 5
+            TextHint = 'Account Number'
+          end
+          object ebNewKey: TEdit
+            Left = 96
+            Height = 21
+            Top = 88
+            Width = 370
+            TabOrder = 6
+            TextHint = 'BASE58 Encoded Public Key Of New Owner'
+          end
+          object ebTimeLock: TEdit
+            Left = 96
+            Height = 21
+            Top = 112
+            Width = 91
+            TabOrder = 7
+            TextHint = 'Block number'
+          end
+          object sbSearchListerSellerAccount: TSpeedButton
+            Left = 470
+            Height = 22
+            Top = 65
+            Width = 23
+            Glyph.Data = {
+              36030000424D3803000000000000360000002800000010000000100000000100
+              18000000000000000000120B0000120B00000000000000000000FF00FF4A667C
+              BE9596FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FF6B9CC31E89E84B7AA3C89693FF00FFFF00FFFF00FFFF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF4BB4FE51B5FF
+              2089E94B7AA2C69592FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFFF00FF51B7FE51B3FF1D87E64E7AA0CA9792FF00FFFF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
+              51B7FE4EB2FF1F89E64E7BA2B99497FF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF52B8FE4BB1FF2787D95F6A76FF
+              00FFB0857FC09F94C09F96BC988EFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
+              FF00FFFF00FF55BDFFB5D6EDBF9D92BB9B8CE7DAC2FFFFE3FFFFE5FDFADAD8C3
+              B3B58D85FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFCEA795FD
+              EEBEFFFFD8FFFFDAFFFFDBFFFFE6FFFFFBEADDDCAE837FFF00FFFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FFC1A091FBDCA8FEF7D0FFFFDBFFFFE3FFFFF8FFFF
+              FDFFFFFDC6A99CFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFC1A091FEE3ACF1
+              C491FCF2CAFFFFDDFFFFE4FFFFF7FFFFF7FFFFE9EEE5CBB9948CFF00FFFF00FF
+              FF00FFFF00FFFF00FFC2A191FFE6AEEEB581F7DCAEFEFDD8FFFFDFFFFFE3FFFF
+              E4FFFFE0F3ECD2BB968EFF00FFFF00FFFF00FFFF00FFFF00FFBC978CFBE7B7F4
+              C791F2C994F8E5B9FEFCD8FFFFDDFFFFDCFFFFE0E2D2BAB68E86FF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FFD9C3A9FFFEE5F7DCB8F2C994F5D4A5FAE8BDFDF4
+              C9FDFBD6B69089FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB58D85E8
+              DEDDFFFEF2F9D8A3F4C48CF9D49FFDEAB8D0B49FB89086FF00FFFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FFFF00FFAD827FC9AA9EEFE0B7EFDFB2E7CEACB890
+              86B89086FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
+              00FFFF00FFBA968ABB988CB79188FF00FFFF00FFFF00FFFF00FF
+            }
+            OnClick = sbSearchListerSellerAccountClick
+          end
+          object rbListAccountForAccountSwap: TRadioButton
+            Left = 160
+            Height = 19
+            Top = 26
+            Width = 159
+            Caption = 'List for Atomic Account Swap'
+            TabOrder = 2
+          end
+          object rbListAccountForCoinSwap: TRadioButton
+            Left = 160
+            Height = 19
+            Top = 46
+            Width = 141
+            Caption = 'List for Atomic Coin Swap'
+            TabOrder = 3
+          end
+          object sbTimeLock: TSpeedButton
+            Left = 192
+            Height = 22
+            Top = 112
+            Width = 23
+            Glyph.Data = {
+              36030000424D3603000000000000360000002800000010000000100000000100
+              18000000000000030000120B0000120B00000000000000000000FF00FF53B6F0
+              4A95DFC6CEEDFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FF1B59D3298DEA7AFDFF47A2E6C1C9ECFF00FFFF00FFFF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3F9BE4207EE2
+              1C74DE7AFFFF4398E1CFD5F0FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFA3B5E758CDF52B81DD1676DC72FCFF4390DFE5E9F7FF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB385EA
+              57D1F7287CD90F72DB71FFFF4DA9E8ECB4F9FF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFFF00FFFF00FF96A7E258D3F72883D90F5FCF6EFFFF50
+              AFE8B0B7E5FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
+              FF00FF9EADE456D8F8277CD40E56C86DF6FF2DBEF10E85DD1777D7167EDB166D
+              D17C92D8FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF97A7E356DAF92781D40D
+              97E30ECFFC0ECCFA0ECFFB0ED0FB0ED5FF12BAF45279D1FF00FFFF00FFFF00FF
+              FF00FFFF00FFFF00FFB486EA56CCF31ED1FA09BCF411BFF410BFF310BFF310BE
+              F30FD3FD05B2EFA2B4E6FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6486D72C
+              E3FD09C1F311C4F410C4F40EC8F60ECCF70BC1F30BDCFE3581D6FF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FF4A95DF1DE4FD0CC5F311C7F40ED1F70FC2F139C6
+              F01FD6F805D1F843BBEBFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF4491DF1A
+              E8FD00C5F206CEF600C2F27AAAE5FF00FF8CC9ED64F4FF70CFEFFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FF6390DC44F3FE0ECFF429DAF635D8F5FF00FFFF00
+              FF9DC4EA63FFFF7EBDE8FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFBFCEF0AD
+              EBF972F8FF5DE3F65EEAF964D7F384E4F559F1FC5CE8F8B1C6EDFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FFFF00FF9EB9E99DE5F77DF9FD63F2FC60F7FD66FC
+              FE77EBF9A7C3EBFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
+              00FFCDDAF39CC1EC8AC7EC85C5EB9CC8EDB3C5EDFF00FFFF00FF
+            }
+            OnClick = sbSearchListerSellerAccountClick
+          end
+          object ebHashLock: TEdit
+            Left = 280
+            Height = 21
+            Top = 112
+            Width = 186
+            TabOrder = 8
+          end
+          object btnHashLock: TSpeedButton
+            Left = 470
+            Height = 22
+            Top = 112
+            Width = 23
+            Glyph.Data = {
+              36030000424D3603000000000000360000002800000010000000100000000100
+              18000000000000030000120B0000120B00000000000000000000FF00FF53B6F0
+              4A95DFC6CEEDFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FF1B59D3298DEA7AFDFF47A2E6C1C9ECFF00FFFF00FFFF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3F9BE4207EE2
+              1C74DE7AFFFF4398E1CFD5F0FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFA3B5E758CDF52B81DD1676DC72FCFF4390DFE5E9F7FF
+              00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB385EA
+              57D1F7287CD90F72DB71FFFF4DA9E8ECB4F9FF00FFFF00FFFF00FFFF00FFFF00
+              FFFF00FFFF00FFFF00FFFF00FFFF00FF96A7E258D3F72883D90F5FCF6EFFFF50
+              AFE8B0B7E5FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
+              FF00FF9EADE456D8F8277CD40E56C86DF6FF2DBEF10E85DD1777D7167EDB166D
+              D17C92D8FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF97A7E356DAF92781D40D
+              97E30ECFFC0ECCFA0ECFFB0ED0FB0ED5FF12BAF45279D1FF00FFFF00FFFF00FF
+              FF00FFFF00FFFF00FFB486EA56CCF31ED1FA09BCF411BFF410BFF310BFF310BE
+              F30FD3FD05B2EFA2B4E6FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6486D72C
+              E3FD09C1F311C4F410C4F40EC8F60ECCF70BC1F30BDCFE3581D6FF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FF4A95DF1DE4FD0CC5F311C7F40ED1F70FC2F139C6
+              F01FD6F805D1F843BBEBFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF4491DF1A
+              E8FD00C5F206CEF600C2F27AAAE5FF00FF8CC9ED64F4FF70CFEFFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FF6390DC44F3FE0ECFF429DAF635D8F5FF00FFFF00
+              FF9DC4EA63FFFF7EBDE8FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFBFCEF0AD
+              EBF972F8FF5DE3F65EEAF964D7F384E4F559F1FC5CE8F8B1C6EDFF00FFFF00FF
+              FF00FFFF00FFFF00FFFF00FFFF00FF9EB9E99DE5F77DF9FD63F2FC60F7FD66FC
+              FE77EBF9A7C3EBFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
+              00FFCDDAF39CC1EC8AC7EC85C5EB9CC8EDB3C5EDFF00FFFF00FF
+            }
+            OnClick = sbSearchListerSellerAccountClick
+          end
+          object lblHashLock: TLabel
+            Left = 222
+            Height = 13
+            Top = 115
+            Width = 49
+            Alignment = taRightJustify
+            Caption = 'Hash-Lock'
+            ParentColor = False
           end
         end
         object tsDelist: TTabSheet
@@ -680,8 +778,8 @@ object FRMOperation: TFRMOperation
             Left = 204
             Height = 13
             Top = 61
-            Width = 231
-            Caption = 'excessive amount will remain on bought account'
+            Width = 234
+            Caption = 'any over-payment will remain on bought account'
             Font.Color = clGray
             Font.Height = -11
             Font.Name = 'Tahoma'
@@ -833,6 +931,7 @@ object FRMOperation: TFRMOperation
             Top = 29
             Width = 258
             TabOrder = 0
+            TextHint = 'Account name (null or 3..32 chars)'
           end
           object lblChangeType: TLabel
             Left = 13
@@ -850,11 +949,30 @@ object FRMOperation: TFRMOperation
             Top = 56
             Width = 76
             TabOrder = 1
+            TextHint = '0..65535'
+          end
+          object lblChangeAccountData: TLabel
+            Left = 13
+            Height = 13
+            Top = 88
+            Width = 100
+            Alignment = taRightJustify
+            AutoSize = False
+            Caption = 'Change Data'
+            ParentColor = False
+          end
+          object ebChangeAccountData: TEdit
+            Left = 118
+            Height = 21
+            Top = 84
+            Width = 386
+            TabOrder = 2
+            TextHint = 'Hexadecimal value (0..32 bytes)'
           end
         end
       end
       object lblSignerAccount: TLabel
-        Left = 176
+        Left = 278
         Height = 13
         Top = 188
         Width = 131
@@ -862,14 +980,14 @@ object FRMOperation: TFRMOperation
         ParentColor = False
       end
       object ebSignerAccount: TEdit
-        Left = 325
+        Left = 427
         Height = 21
         Top = 184
         Width = 82
         TabOrder = 3
       end
       object sbSearchSignerAccount: TSpeedButton
-        Left = 411
+        Left = 513
         Height = 22
         Top = 184
         Width = 23

+ 18 - 2
src/gui-classic/UFRMRandomOperations.lfm

@@ -1,11 +1,15 @@
 object FRMRandomOperations: TFRMRandomOperations
-  Left = 876
+  Left = 744
   Height = 229
-  Top = 391
+  Top = 390
   Width = 439
   Caption = 'Random Operations'
   ClientHeight = 229
   ClientWidth = 439
+  Color = clBtnFace
+  Font.Color = clWindowText
+  Font.Height = -11
+  Font.Name = 'Tahoma'
   OnClose = FormClose
   OnCloseQuery = FormCloseQuery
   OnCreate = FormCreate
@@ -31,12 +35,15 @@ object FRMRandomOperations: TFRMRandomOperations
       Align = alClient
       AutoSize = False
       Caption = 'WARNING! This form will generate RANDOM operations using your private keys!!!'
+      Color = clBtnFace
       Font.Color = clRed
       Font.Height = -13
+      Font.Name = 'Tahoma'
       Font.Style = [fsBold]
       Layout = tlCenter
       ParentColor = False
       ParentFont = False
+      Transparent = False
       WordWrap = True
     end
   end
@@ -69,6 +76,15 @@ object FRMRandomOperations: TFRMRandomOperations
         OnClick = bbRandomOperationsClick
         TabOrder = 0
       end
+      object cbMaxSpeedMode: TCheckBox
+        Left = 232
+        Height = 19
+        Top = 6
+        Width = 101
+        Caption = 'Max speed mode'
+        OnClick = cbMaxSpeedModeClick
+        TabOrder = 1
+      end
     end
     object mLogs: TMemo
       Left = 0

+ 266 - 11
src/gui-classic/UFRMRandomOperations.pas

@@ -44,6 +44,7 @@ type
     FOnUpdated: TNotifyEvent;
     FNeedSanitize : Boolean;
     FAllowExecute: Boolean;
+    FMaxOperationsPerSecond: Integer;
     procedure OnBankNewBlock(Sender : TObject);
   protected
     FBankNotify : TPCBankNotify;
@@ -56,7 +57,7 @@ type
     FnCallsToAddNodeFailed : Int64;
     procedure BCExecute; override;
   public
-    Constructor Create(ASourceNode: TNode; ASourceWalletKeys: TWalletKeysExt);
+    Constructor Create(ASourceNode: TNode; ASourceWalletKeys: TWalletKeysExt; AMaxOperationsPerSecond : Integer);
     Destructor Destroy; override;
     property LastCall_OperationsTotal : Integer read FLastCall_OperationsTotal;
     property LastCall_OperationsExecuted : Integer read FLastCall_OperationsExecuted;
@@ -64,6 +65,7 @@ type
     property LastCall_Error : String read FLastCall_Error;
     property OnUpdated : TNotifyEvent read FOnUpdated write FOnUpdated;
     property AllowExecute : Boolean read FAllowExecute write FAllowExecute;
+    property MaxOperationsPerSecond : Integer read FMaxOperationsPerSecond write FMaxOperationsPerSecond;
   end;
 
   { TFRMRandomOperations }
@@ -75,11 +77,13 @@ type
     pnlClient: TPanel;
     pnlTop: TPanel;
     pnlTop1: TPanel;
+    cbMaxSpeedMode : TCheckBox;
     procedure bbRandomOperationsClick(Sender: TObject);
     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
+    procedure cbMaxSpeedModeClick(Sender: TObject);
   private
     FSourceNode: TNode;
     FSourceWalletKeys: TWalletKeysExt;
@@ -87,6 +91,7 @@ type
     FCurrOperationsComp : TPCOperationsComp;
     FRandomGeneratorThread : TRandomGeneratorThread;
     FInternalLog : TLog;
+    FMaxOperationsPerSecond : Integer;
     procedure SetSourceNode(AValue: TNode);
     procedure SetSourceWalletKeys(AValue: TWalletKeysExt);
     procedure NewLog(logTxt : String);
@@ -104,11 +109,17 @@ type
 
   TRandomGenerateOperation = Class
   private
+    class function GetRandomPayload(Const AStartsWith : String) : TRawBytes;
   public
     class function GetRandomOwnDestination(const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt; out nAccount : Cardinal) : Boolean;
     class function GetRandomSigner(const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt; out iKey : Integer; out nAccount : Cardinal) : Boolean;
     class function GenerateOpTransactions(current_protocol : Word; Maxtransaction : Integer; const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt) : Integer;
     class function GenerateOpMultiOperation(current_protocol : Word; const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt) : Boolean;
+    class function GenerateOpChangeKey(current_protocol : Word; const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt) : Integer;
+    class function GenerateOpListAccountForSale(current_protocol : Word; const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt) : Integer;
+    class function GenerateOpBuyAccount(current_protocol : Word; const operationsComp : TPCOperationsComp; const aWalletKeys : TWalletKeysExt) : Integer;
+    class function GetHashLock_Public : T32Bytes;
+    class function GetHashLock_Private : TRawBytes;
   end;
 
 implementation
@@ -131,14 +142,21 @@ Var nCounter, nTotalRound, iLastSend, i : Integer;
   operationsComp : TPCOperationsComp;
   ohtToAdd : TOperationsHashTree;
   errors : String;
-  nAddedOperations : Integer;
+  nAddedOperations, nMaxTransactionsValue, nExecutedSinceLastTC : Integer;
+  LLastTC : TTickCount;
 begin
   operationsComp := TPCOperationsComp.Create(Nil);
   try
     operationsComp.bank := FSourceNode.Bank;
     iLastSend := -1;
+    LLastTC := TPlatform.GetTickCount;
+    nExecutedSinceLastTC := 0;
     while (Not Terminated) do begin
-      nTotalRound := Random(100);
+      if FMaxOperationsPerSecond<=0 then begin
+        nTotalRound := Random(100);
+      end else begin
+        nTotalRound := Random(FMaxOperationsPerSecond)+1;
+      end;
       nCounter := 0;
       if FNeedSanitize then begin
         FNeedSanitize := False;
@@ -150,15 +168,25 @@ begin
         inc(nCounter);
         //
         Case Random(30) of
-          0..20 : begin
-            inc(FnOperationsCreated,TRandomGenerateOperation.GenerateOpTransactions(FSourceNode.Bank.SafeBox.CurrentProtocol,100,operationsComp,FSourceWalletKeys));
+          0..10 : begin
+            if FMaxOperationsPerSecond>0 then nMaxTransactionsValue := Random(FMaxOperationsPerSecond)+1
+            else nMaxTransactionsValue := Random(200)+1;
+
+            inc(FnOperationsCreated,TRandomGenerateOperation.GenerateOpTransactions(FSourceNode.Bank.SafeBox.CurrentProtocol,nMaxTransactionsValue,operationsComp,FSourceWalletKeys));
+          end;
+          11..15 : begin
+            inc(FnOperationsCreated,TRandomGenerateOperation.GenerateOpChangeKey(FSourceNode.Bank.SafeBox.CurrentProtocol,operationsComp,FSourceWalletKeys));
           end;
-          21..25 : begin
+          18..22 : begin
+            inc(FnOperationsCreated,TRandomGenerateOperation.GenerateOpListAccountForSale(FSourceNode.Bank.SafeBox.CurrentProtocol,operationsComp,FSourceWalletKeys));
+          end;
+          25..29 : begin
             If TRandomGenerateOperation.GenerateOpMultiOperation(FSourceNode.Bank.SafeBox.CurrentProtocol,operationsComp,FSourceWalletKeys) then inc(FnOperationsCreated)
             else inc(FnOperationsCreatedFailed);
           end;
         end;
       end;
+
       if (Not Terminated) And (Not FNeedSanitize) And (FAllowExecute) then begin
         //
         ohtToAdd := TOperationsHashTree.Create;
@@ -184,8 +212,18 @@ begin
           ohtToAdd.Free;
         End;
         //
-        if Assigned(FOnUpdated) then FOnUpdated(Self);
+        if FLastCall_OperationsTotal>0 then begin
+          if Assigned(FOnUpdated) then FOnUpdated(Self);
+        end;
+
+        inc(nExecutedSinceLastTC,nAddedOperations);
+
+      end;
+      if (FMaxOperationsPerSecond>0) and (nExecutedSinceLastTC>=FMaxOperationsPerSecond) then begin
+        while (Not Terminated) and (FAllowExecute) and (TPlatform.GetElapsedMilliseconds(LLastTC)<1000) do sleep(5);
       end;
+      LLastTC := TPlatform.GetTickCount;
+      nExecutedSinceLastTC := 0;
       Sleep(1);
     end;
   finally
@@ -193,7 +231,7 @@ begin
   end;
 end;
 
-constructor TRandomGeneratorThread.Create(ASourceNode: TNode; ASourceWalletKeys: TWalletKeysExt);
+constructor TRandomGeneratorThread.Create(ASourceNode: TNode; ASourceWalletKeys: TWalletKeysExt; AMaxOperationsPerSecond : Integer);
 begin
   FSourceNode := ASourceNode;
   FSourceWalletKeys := ASourceWalletKeys;
@@ -213,6 +251,9 @@ begin
   FBankNotify.OnNewBlock:=OnBankNewBlock;
   FNeedSanitize := True;
   FAllowExecute := False;
+  if AMaxOperationsPerSecond>=0 then
+    FMaxOperationsPerSecond := AMaxOperationsPerSecond
+  else FMaxOperationsPerSecond := 0;
   inherited Create(False);
 end;
 
@@ -226,6 +267,16 @@ end;
 
 { TRandomGenerateOperation }
 
+class function TRandomGenerateOperation.GetHashLock_Private: TRawBytes;
+begin
+  Result.FromString('PRIVATE');
+end;
+
+class function TRandomGenerateOperation.GetHashLock_Public: T32Bytes;
+begin
+  Result := TBaseType.To32Bytes( TCrypto.DoSha256( GetHashLock_Private ) );
+end;
+
 class function TRandomGenerateOperation.GetRandomOwnDestination(const operationsComp: TPCOperationsComp; const aWalletKeys: TWalletKeysExt; out nAccount: Cardinal): Boolean;
 var
   nRounds : Integer;
@@ -248,6 +299,21 @@ begin
   until (Result) Or (nRounds>0);
 end;
 
+class function TRandomGenerateOperation.GetRandomPayload(
+  const AStartsWith: String): TRawBytes;
+var i,j : Integer;
+begin
+  Result.FromString(AStartsWith);
+  j := Random(255);
+  if j<Length(Result) then j := Length(Result);
+
+  SetLength(Result,j);
+  for i := Length(Result) to j-1 do begin
+    Result[j] := Random(127-32)+32;
+  end;
+
+end;
+
 class function TRandomGenerateOperation.GetRandomSigner(const operationsComp: TPCOperationsComp; const aWalletKeys: TWalletKeysExt; out iKey: Integer; out nAccount: Cardinal): Boolean;
 var
   bRoundsIKey, bRoundsNAccount : Boolean;
@@ -290,9 +356,10 @@ class function TRandomGenerateOperation.GenerateOpTransactions(current_protocol
 var nAccount, nAccountTarget : Cardinal;
   iKey, nRounds : Integer;
   opTx : TOpTransaction;
-  senderAcc : TAccount;
+  senderAcc, LDestAcc : TAccount;
   amount,fees : Int64;
   errors : String;
+  LPayload : TRawBytes;
 begin
   Result := 0;
   If Not GetRandomSigner(operationsComp,aWalletKeys,iKey,nAccount) then Exit;
@@ -301,11 +368,17 @@ begin
   nRounds := 0;
   while (nRounds<Maxtransaction) do begin
     senderAcc := operationsComp.SafeBoxTransaction.Account(nAccount);
+    LDestAcc := operationsComp.SafeBoxTransaction.Account(nAccountTarget);
+    if TAccountComp.IsAccountForSwap( LDestAcc.accountInfo ) then begin
+      // Special case, will swap? Will need to provide a HASHLOCK in payload
+      LPayload := GetHashLock_Private;
+    end else LPayload := Nil;
+
     amount := 1; // Minimal amount
     if (Random(500)<1) then fees := 0
     else fees := 1; // Minimal fee
     if (senderAcc.balance>2) then begin
-      opTx := TOpTransaction.CreateTransaction(current_protocol,senderAcc.account,senderAcc.n_operation+1,nAccountTarget,aWalletKeys.Key[iKey].PrivateKey,amount,fees,Nil);
+      opTx := TOpTransaction.CreateTransaction(current_protocol,senderAcc.account,senderAcc.n_operation+1,nAccountTarget,aWalletKeys.Key[iKey].PrivateKey,amount,fees,LPayload);
       Try
         if operationsComp.AddOperation(True,opTx,errors) then inc(Result);
       finally
@@ -317,6 +390,174 @@ begin
   end;
 end;
 
+class function TRandomGenerateOperation.GenerateOpBuyAccount(
+  current_protocol: Word; const operationsComp: TPCOperationsComp;
+  const aWalletKeys: TWalletKeysExt): Integer;
+begin
+  raise Exception.Create('XXXXXX TODO TRandomGenerateOperation');
+end;
+
+class function TRandomGenerateOperation.GenerateOpChangeKey(
+  current_protocol: Word;
+  const operationsComp: TPCOperationsComp;
+  const aWalletKeys: TWalletKeysExt): Integer;
+var nAccount, nAccountTarget : Cardinal;
+  iKey, iNewPubKey : Integer;
+  opCk : TOpChangeKey;
+  senderAcc : TAccount;
+  fees : Int64;
+  errors : String;
+  opClass : TPCOperationClass;
+begin
+  Result := 0;
+  If Not GetRandomSigner(operationsComp,aWalletKeys,iKey,nAccount) then Exit;
+  if Random(1)=0 then begin
+    nAccountTarget := Random( aWalletKeys.AccountsKeyList.AccountKeyList[iKey].Count );
+    opClass := TOpChangeKeySigned;
+  end else begin
+    nAccountTarget := nAccount;
+    opClass := TOpChangeKey;
+  end;
+
+  if Not GetRandomOwnDestination(operationsComp,aWalletKeys,nAccountTarget) then Exit;
+  iNewPubKey := Random(aWalletKeys.Count);
+
+  if iKey=iNewPubKey then Exit;
+
+  senderAcc := operationsComp.SafeBoxTransaction.Account(nAccount);
+  if (Random(500)<1) then fees := 0
+  else fees := 1; // Minimal fee
+  if (senderAcc.balance>2) then begin
+    opCk := TOpChangeKey(opClass.NewInstance).Create(current_protocol,senderAcc.account,senderAcc.n_operation+1,nAccountTarget,
+      aWalletKeys.Key[iKey].PrivateKey,
+      aWalletKeys.Key[iNewPubKey].AccountKey,
+      fees,Nil);
+    Try
+      if operationsComp.AddOperation(True,opCk,errors) then inc(Result);
+    finally
+      opCk.Free;
+    end;
+  end;
+
+end;
+
+class function TRandomGenerateOperation.GenerateOpListAccountForSale(
+  current_protocol: Word; const operationsComp: TPCOperationsComp;
+  const aWalletKeys: TWalletKeysExt): Integer;
+var nSigner, nTarget : Cardinal;
+  iKey, iNewPubKey, i, j : Integer;
+  opList : TOpListAccountForSaleOrSwap;
+  opDelist : TOpDelistAccountForSale;
+  SignerAccount, AuxAccount : TAccount;
+  fees : Int64;
+  errors : String;
+  DoDelist : Boolean;
+begin
+  Result := 0;
+  If Not GetRandomSigner(operationsComp,aWalletKeys,iKey,nSigner) then Exit;
+  SignerAccount := operationsComp.SafeBoxTransaction.Account(nSigner);
+
+  if (Random(500)<1) then fees := 0
+  else fees := 1; // Minimal fee
+
+  if TAccountComp.IsAccountForSaleOrSwap(SignerAccount.accountInfo) then begin
+    // Delist:
+    i := Random( aWalletKeys.AccountsKeyList.AccountKeyList[ iKey ].Count );
+    j := i;
+    DoDelist := False;
+    Repeat
+      AuxAccount := operationsComp.SafeBoxTransaction.Account(j);
+      if TAccountComp.IsAccountForSale(AuxAccount.accountInfo) then begin
+        nTarget := j;
+        DoDelist := True;
+      end;
+
+      //
+      if j<aWalletKeys.AccountsKeyList.AccountKeyList[ iKey ].Count then inc(j)
+      else j:=0;
+    Until (j=i) or (DoDelist);
+    if (DoDelist) then begin
+      try
+        opDelist := TOpDelistAccountForSale.CreateDelistAccountForSale(current_protocol,
+          nSigner,SignerAccount.n_operation+1,nTarget,fees,
+          aWalletKeys.Key[iKey].PrivateKey,
+          GetRandomPayload(''));
+        if operationsComp.AddOperation(True,opDelist,errors) then inc(Result);
+      finally
+        opDelist.Free;
+      end;
+    end;
+
+  end else begin
+
+    if Random(1)=0 then begin
+      nTarget := Random( aWalletKeys.AccountsKeyList.AccountKeyList[iKey].Count );
+    end else begin
+      nTarget := nSigner;
+    end;
+
+
+    opList := Nil;
+    try
+      case Random(4) of
+        0 : // Private sale:
+          begin
+            // Private sale:
+            opList := TOpListAccountForSaleOrSwap.CreateListAccountForSaleOrSwap(current_protocol,
+              as_ForSale,
+              nSigner, SignerAccount.n_operation+1, nTarget, Random(50000)+1,fees,
+              Random( operationsComp.SafeBoxTransaction.FreezedSafeBox.AccountsCount ),
+              aWalletKeys.Key[ Random(aWalletKeys.Count) ].AccountKey,
+              operationsComp.OperationBlock.block + Random(1000),
+              aWalletKeys.Key[iKey].PrivateKey,
+              CT_HashLock_NUL,
+              GetRandomPayload(''));
+          end;
+        1 : // Publis sale:
+          begin
+            opList := TOpListAccountForSaleOrSwap.CreateListAccountForSaleOrSwap(current_protocol,
+              as_ForSale,
+              nSigner, SignerAccount.n_operation+1, nTarget, Random(50000)+1,fees,
+              Random( operationsComp.SafeBoxTransaction.FreezedSafeBox.AccountsCount ),
+              CT_TECDSA_Public_Nul,
+              0,
+              aWalletKeys.Key[iKey].PrivateKey,
+              CT_HashLock_NUL,
+              GetRandomPayload(''));
+          end;
+        2 : // Atomic Account Swap
+          begin
+            opList := TOpListAccountForSaleOrSwap.CreateListAccountForSaleOrSwap(current_protocol,
+              as_ForAtomicAccountSwap,
+              nSigner, SignerAccount.n_operation+1, nTarget, Random(50000)+1,fees,
+              Random( operationsComp.SafeBoxTransaction.FreezedSafeBox.AccountsCount ),
+              aWalletKeys.Key[ Random(aWalletKeys.Count) ].AccountKey,
+              operationsComp.OperationBlock.block + Random(1000),
+              aWalletKeys.Key[iKey].PrivateKey,
+              GetHashLock_Public,
+              GetRandomPayload(''));
+          end;
+        3 : // Atomic Coin Swap
+          begin
+            opList := TOpListAccountForSaleOrSwap.CreateListAccountForSaleOrSwap(current_protocol,
+              as_ForAtomicCoinSwap,
+              nSigner, SignerAccount.n_operation+1, nTarget, Random(50000)+1,fees,
+              Random( operationsComp.SafeBoxTransaction.FreezedSafeBox.AccountsCount ),
+              CT_TECDSA_Public_Nul,
+              operationsComp.OperationBlock.block + Random(1000),
+              aWalletKeys.Key[iKey].PrivateKey,
+              GetHashLock_Public,
+              GetRandomPayload(''));
+          end;
+      end;
+      if operationsComp.AddOperation(True,opList,errors) then inc(Result);
+    finally
+      opList.Free;
+    end;
+
+  end;
+end;
+
 class function TRandomGenerateOperation.GenerateOpMultiOperation(current_protocol : Word; const operationsComp: TPCOperationsComp; const aWalletKeys: TWalletKeysExt): Boolean;
    procedure DoSign(opMulti : TOpMultiOperation);
    var n : Integer;
@@ -432,6 +673,7 @@ begin
   FInternalLog := TLog.Create(Self);
   FInternalLog.ProcessGlobalLogs := False;
   FInternalLog.OnNewLog := OnInternalLog;
+  FMaxOperationsPerSecond := 0;
   mLogs.Clear;
 end;
 
@@ -443,6 +685,8 @@ begin
 end;
 
 procedure TFRMRandomOperations.bbRandomOperationsClick(Sender: TObject);
+var sValue : String;
+  n : Integer;
 begin
   {$IFDEF TESTNET}
   If IsProcessingRandomOperations then begin
@@ -450,6 +694,12 @@ begin
     bbRandomOperations.Caption:='GENERATE RANDOM';
   end else begin
     if Assigned(FRandomGeneratorThread) then begin
+      sValue := IntToStr(FMaxOperationsPerSecond);
+      if InputQuery('Max Operations per second','Max operations per second (0=Max)',sValue) then begin
+        n := StrToIntDef(sValue,-1);
+        if (n>=0) then FMaxOperationsPerSecond := n;
+      end;
+      FRandomGeneratorThread.MaxOperationsPerSecond := n;
       FRandomGeneratorThread.AllowExecute := True;
       bbRandomOperations.Caption:='STOP RANDOM';
     end else bbRandomOperations.Caption:='???';
@@ -459,6 +709,11 @@ begin
   {$ENDIF}
 end;
 
+procedure TFRMRandomOperations.cbMaxSpeedModeClick(Sender: TObject);
+begin
+//
+end;
+
 procedure TFRMRandomOperations.FormClose(Sender: TObject; var CloseAction: TCloseAction);
 begin
   CloseAction := caFree;
@@ -516,7 +771,7 @@ begin
     FreeAndNil(FRandomGeneratorThread);
   end;
   if (Not DestroyOnly) And Assigned(FSourceNode) And Assigned(FSourceWalletKeys) then begin
-    FRandomGeneratorThread := TRandomGeneratorThread.Create(FSourceNode,FSourceWalletKeys);
+    FRandomGeneratorThread := TRandomGeneratorThread.Create(FSourceNode,FSourceWalletKeys,FMaxOperationsPerSecond);
     FRandomGeneratorThread.OnUpdated:=OnRandomGeneratoThreadUpdated;
   end;
 end;

+ 10 - 1
src/gui-classic/UFRMWallet.pas

@@ -887,6 +887,7 @@ procedure TFRMWallet.FillAccountInformation(const Strings: TStrings;
   const AccountNumber: Cardinal);
 Var account : TAccount;
   s : String;
+  LjsonObj : TPCJSONObject;
 begin
   if AccountNumber<0 then exit;
   account := FNode.GetMempoolAccount(AccountNumber);
@@ -941,6 +942,14 @@ begin
           [account.accountInfo.locked_until_block,FNode.Bank.BlocksCount]));
     end;
   end;
+  LjsonObj := TPCJSONObject.Create;
+  Try
+    TPascalCoinJSONComp.FillAccountObject(account,LjsonObj);
+    Strings.Add('ACCOUNT JSON:');
+    Strings.Add(LjsonObj.ToJSON(False));
+  Finally
+    LjsonObj.Free;
+  end;
 
 end;
 
@@ -989,7 +998,7 @@ begin
   jsonObj := TPCJSONObject.Create;
   Try
     TPascalCoinJSONComp.FillOperationObject(OperationResume,FNode.Bank.BlocksCount,jsonObj);
-    Strings.Add('JSON:');
+    Strings.Add('OPERATION JSON:');
     Strings.Add(jsonObj.ToJSON(False));
   Finally
     jsonObj.Free;