From 3a7bc4b25a8f46776466986907a0479b83edfb04 Mon Sep 17 00:00:00 2001 From: Afshin Arani Date: Thu, 12 Oct 2023 12:53:13 +0330 Subject: [PATCH] Backend/Ether: rm etcIsMomentarilyCentralized flag ETC was previously marked as non-centeralized[1], this commit removes this flag since it's no longer needed. [1] 9392215bfa6c0f625ddce6423b3bf77a0dea8558 --- src/GWallet.Backend/Ether/EtherServer.fs | 34 +++++------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/src/GWallet.Backend/Ether/EtherServer.fs b/src/GWallet.Backend/Ether/EtherServer.fs index 137d97564..47cf4d8b4 100644 --- a/src/GWallet.Backend/Ether/EtherServer.fs +++ b/src/GWallet.Backend/Ether/EtherServer.fs @@ -322,11 +322,9 @@ module Server = | ServerSelectionMode.Fast -> 3u | ServerSelectionMode.Analysis -> 2u - let etcEcosystemIsMomentarilyCentralized = false - let private FaultTolerantParallelClientInnerSettings (numberOfConsistentResponsesRequired: uint32) (mode: ServerSelectionMode) - currency + _currency maybeConsistencyConfig = let consistencyConfig = @@ -334,10 +332,7 @@ module Server = | None -> SpecificNumberOfConsistentResponsesRequired numberOfConsistentResponsesRequired | Some specificConsistencyConfig -> specificConsistencyConfig - let retries = - match currency with - | Currency.ETC when etcEcosystemIsMomentarilyCentralized -> Config.NUMBER_OF_RETRIES_TO_SAME_SERVERS * 2u - | _ -> Config.NUMBER_OF_RETRIES_TO_SAME_SERVERS + let retries = Config.NUMBER_OF_RETRIES_TO_SAME_SERVERS { NumberOfParallelJobsAllowed = NumberOfParallelJobsForMode mode @@ -359,11 +354,7 @@ module Server = } let private FaultTolerantParallelClientDefaultSettings (mode: ServerSelectionMode) (currency: Currency) = - let numberOfConsistentResponsesRequired = - if etcEcosystemIsMomentarilyCentralized && currency = Currency.ETC then - 1u - else - 2u + let numberOfConsistentResponsesRequired = 2u FaultTolerantParallelClientInnerSettings numberOfConsistentResponsesRequired mode currency @@ -372,9 +363,7 @@ module Server = (currency: Currency) (cacheOrInitialBalanceMatchFunc: decimal->bool) = let consistencyConfig = - if etcEcosystemIsMomentarilyCentralized && currency = Currency.ETC then - None - elif mode = ServerSelectionMode.Fast then + if mode = ServerSelectionMode.Fast then Some (OneServerConsistentWithCertainValueOrTwoServers cacheOrInitialBalanceMatchFunc) else None @@ -389,7 +378,7 @@ module Server = let Web3ServerToRetrievalFunc (server: ServerDetails) (web3ClientFunc: SomeWeb3->Async<'R>) - currency + _currency : Async<'R> = let HandlePossibleEtherFailures (job: Async<'R>): Async<'R> = @@ -404,12 +393,7 @@ module Server = return raise <| FSharpUtil.ReRaise ex } - let connectionTimeout = - match currency with - | Currency.ETC when etcEcosystemIsMomentarilyCentralized -> - Config.DEFAULT_NETWORK_TIMEOUT + Config.DEFAULT_NETWORK_TIMEOUT - | _ -> - Config.DEFAULT_NETWORK_TIMEOUT + let connectionTimeout = Config.DEFAULT_NETWORK_TIMEOUT async { let web3Server = Web3Server (connectionTimeout, server) @@ -660,11 +644,7 @@ module Server = return hexBigInteger } GetRandomizedFuncs currency web3Func - let minResponsesRequired = - if etcEcosystemIsMomentarilyCentralized && currency = Currency.ETC then - 1u - else - 2u + let minResponsesRequired = 2u return! faultTolerantEtherClient.Query (FaultTolerantParallelClientDefaultSettings ServerSelectionMode.Fast