Browse Source

Allow config PayToKey maximum price

PascalCoin 4 years ago
parent
commit
1878c21642
4 changed files with 11 additions and 1 deletions
  1. 4 1
      src/core/UNode.pas
  2. 2 0
      src/core/upcdaemon.pas
  3. 1 0
      src/gui-classic/UFRMWallet.pas
  4. 4 0
      src/pascalcoin_daemon.ini

+ 4 - 1
src/core/UNode.pas

@@ -64,6 +64,7 @@ Type
     FSentOperations : TOrderedRawList;
     FBroadcastData : Boolean;
     FUpdateBlockchain: Boolean;
+    FMaxPayToKeyPurchasePrice: Int64;
     {$IFDEF BufferOfFutureOperations}
     FBufferAuxWaitingOperations : TOperationsHashTree;
     {$ENDIF}
@@ -136,6 +137,7 @@ Type
     Function TryResolveEPASA(const AEPasa : TEPasa; out AResolvedAccount: Cardinal; out AResolvedKey : TAccountKey; out ARequiresPurchase : boolean): Boolean; overload;
     Function TryResolveEPASA(const AEPasa : TEPasa; out AResolvedAccount: Cardinal; out AResolvedKey : TAccountKey; out ARequiresPurchase : boolean; out AErrorMessage: String): Boolean; overload;
 
+    Property MaxPayToKeyPurchasePrice: Int64 read FMaxPayToKeyPurchasePrice write FMaxPayToKeyPurchasePrice;
   End;
 
   TThreadSafeNodeNotifyEvent = Class(TPCThread)
@@ -642,6 +644,7 @@ end;
 
 constructor TNode.Create(AOwner: TComponent);
 begin
+  FMaxPayToKeyPurchasePrice := 0;
   FSentOperations := TOrderedRawList.Create;
   FNodeLog := TLog.Create(Self);
   FNodeLog.ProcessGlobalLogs := false;
@@ -895,7 +898,7 @@ begin
     end;
 
     // If no key found, find optimal public purchase account
-    if TryFindPublicSaleAccount(TSettings.MaxPayToKeyPurchasePrice, True, AResolvedAccount) then begin
+    if TryFindPublicSaleAccount(MaxPayToKeyPurchasePrice, True, AResolvedAccount) then begin
       // Account needs to be purchased
       ARequiresPurchase := True;
       Exit(True);

+ 2 - 0
src/core/upcdaemon.pas

@@ -48,6 +48,7 @@ Const
   CT_INI_IDENT_MINPENDINGBLOCKSTODOWNLOADCHECKPOINT = 'MINPENDINGBLOCKSTODOWNLOADCHECKPOINT';
   CT_INI_IDENT_PEERCACHE = 'PEERCACHE';
   CT_INI_IDENT_DATA_FOLDER = 'DATAFOLDER';
+  CT_INI_IDENT_NODE_MAX_PAYTOKEY_MOLINAS = 'MAX_PAYTOKEY_MOLINAS';
   {$IFDEF USE_ABSTRACTMEM}
   CT_INI_IDENT_ABSTRACTMEM_MAX_CACHE_MB = 'ABSTRACTMEM_MAX_CACHE_MB';
   CT_INI_IDENT_ABSTRACTMEM_USE_CACHE_ON_LISTS = 'ABSTRACTMEM_USE_CACHE_ON_LISTS';
@@ -290,6 +291,7 @@ begin
         FWalletKeys.SafeBox := FNode.Node.Bank.SafeBox;
         FNode.Node.NetServer.Port:=FIniFile.ReadInteger(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_NODE_PORT,CT_NetServer_Port);
         FNode.Node.NetServer.MaxConnections:=FIniFile.ReadInteger(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_NODE_MAX_CONNECTIONS,CT_MaxClientsConnected);
+        FNode.Node.MaxPayToKeyPurchasePrice:=FIniFile.ReadInt64(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_NODE_MAX_PAYTOKEY_MOLINAS,CT_DEFAULT_PAY_TO_KEY_MAX_MOLINAS);
         FNode.Node.AutoDiscoverNodes(CT_Discover_IPs);
         FNode.Node.NetServer.Active := true;
 

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

@@ -443,6 +443,7 @@ begin
     FNode := TNode.Node;
     FNode.NetServer.Port := TSettings.InternetServerPort;
     FNode.PeerCache := TSettings.PeerCache+';'+CT_Discover_IPs;
+    FNode.MaxPayToKeyPurchasePrice := TSettings.MaxPayToKeyPurchasePrice;
     // Create RPC server
     FRPCServer := TRPCServer.Create;
     FRPCServer.WalletKeys := WalletKeys;

+ 4 - 0
src/pascalcoin_daemon.ini

@@ -63,3 +63,7 @@ ABSTRACTMEM_CACHE_MAX_ACCOUNTS=
 ;ABSTRACTMEM_CACHE_MAX_PUBKEYS : Integer
 ;Max number of public keys to store at cache - Default 5000
 ABSTRACTMEM_CACHE_MAX_PUBKEYS=
+
+;MAX_PAYTOKEY_MOLINAS : Integer
+;Max MOLINAS (1 MOLINA = 0.0001 PASC) can be paid for a PayToKey operation using EPaAsa format (Default=5000=0.5 PASC)
+MAX_PAYTOKEY_MOLINAS=5000