mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 05:47:39 +00:00
* store: restrict Stripe test keys to test chains, refuse mixed modes * store: limit gas_limit_cap times max_fee_per_gas to 1 ETH * store: prevent start while another key's transactions are pending * store: exit when the instance lock's connection fails, restart always * store: explain the fee cap refusal, match the chain checks' form * store: check pending transactions' key and chain before the chat starts * store: print a lost instance lock before the service stops * store: document start refusals, stuck pending rows and the fee bound * store: build the pending signer refusal without an inferred constraint * store: zero the old key's allowance before dropping its pending rows * store: flush the lost lock line before the service stops * store: name the pending check after the signatures it checks * store: test that another key's pending row stops the start * store: read the chain settings in the start test by field * store: limit each transaction's fee to 1 ETH at signing * store: log a fee capped at 1 ETH for replacements too --------- Co-authored-by: sh-agents <350651734+sh-agents@users.noreply.github.com>
29 lines
1.3 KiB
Haskell
29 lines
1.3 KiB
Haskell
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
module Main where
|
|
|
|
import StoreService.Config (ServiceConfig (..), defaultLogLevel)
|
|
import StoreService.Options (StoreServiceOpts (..))
|
|
import StoreService.Service
|
|
import StoreService.Store.Migrate (instanceLockCheckInterval, withInstanceLock)
|
|
import Control.Logger.Simple (LogConfig (..), setLogLevel, withGlobalLogging)
|
|
import GHC.IO.Encoding (setLocaleEncoding)
|
|
import Simplex.Chat.Terminal (terminalChatConfig)
|
|
import System.IO (hSetEncoding, stderr, stdout, utf8)
|
|
|
|
-- | withGlobalLogging installs the log sinks of the service and the SMP agent, which the chat core otherwise installs only under --log-agent.
|
|
main :: IO ()
|
|
main = do
|
|
-- Without a UTF-8 locale GHC reads the ini and writes logs as ASCII, and throws on a non-ASCII group name.
|
|
setLocaleEncoding utf8
|
|
mapM_ (`hSetEncoding` utf8) [stdout, stderr]
|
|
withGlobalLogging LogConfig {lc_file = Nothing, lc_stderr = True} $ do
|
|
setLogLevel defaultLogLevel
|
|
opts@StoreServiceOpts {runCLI, serviceConfigFile} <- welcomeGetOpts
|
|
serviceCfg <- traverse readConfigOrExit serviceConfigFile
|
|
mapM_ (setLogLevel . serviceLogLevel) serviceCfg
|
|
withInstanceLock instanceLockCheckInterval opts $
|
|
if runCLI
|
|
then storeServiceCLI opts serviceCfg
|
|
else newServiceState >>= storeService opts serviceCfg terminalChatConfig
|