Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stable'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/CI.yml
#	snap/snapcraft.yaml
#	src/GWallet.Backend/Properties/CommonAssemblyInfo.fs
#	src/GWallet.Backend/servers.json
  • Loading branch information
knocte committed Jun 15, 2023
2 parents 24a44e9 + 54da7e3 commit 8f0e93b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/GWallet.Backend/Caching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ type CachedNetworkData =
Balances: Map<Currency,Map<PublicAddress,CachedValue<decimal>>>;
OutgoingTransactions: Map<Currency,Map<PublicAddress,Map<string,CachedValue<decimal>>>>;
}
member self.GetLeastOldDate() =
let allDates =
seq {
for KeyValue(_currency, (_price, date)) in self.UsdPrice do
yield date
for KeyValue(_currency, addressesToBalancesMap) in self.Balances do
for KeyValue(_addr, (_price, date)) in addressesToBalancesMap do
yield date
for KeyValue(_currency, addressesToTxsMap) in self.OutgoingTransactions do
for KeyValue(_addr, txHashToAmountsMap) in addressesToTxsMap do
for KeyValue(_txHash, (_amount, date)) in txHashToAmountsMap do
yield date
}
Seq.sort allDates |> Seq.rev |> Seq.tryHead

static member Empty =
{
UsdPrice = Map.empty
Expand Down
3 changes: 3 additions & 0 deletions src/GWallet.Backend/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ module ServerRegistry =
// there was a mistake when adding this server to geewallet's JSON: it was added in the ETC currency instead of ETH
(currency = Currency.ETC && server.ServerInfo.NetworkPath.Contains "ethrpc.mewapi.io")

// there was a typo when adding this server to geewallet's JSON, see commit 69d90fd2fc22a1f3dd9ef8793f0cd42e3b540df1
|| (currency = Currency.ETC && server.ServerInfo.NetworkPath.Contains "ethercluster.comx/")

let currency,servers = cs
Seq.filter (fun server -> not (isBlackListed currency server)) servers

Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -3953,7 +3953,7 @@
},
{
"ServerInfo": {
"NetworkPath": "www.ethercluster.comx/etc",
"NetworkPath": "ethercluster.com/etc",
"ConnectionType": {
"Encrypted": true,
"Protocol": {
Expand Down
16 changes: 16 additions & 0 deletions src/GWallet.Frontend.Console/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,20 @@ let rec CheckArchivedAccountsAreEmpty(): bool =
not (archivedAccountsInNeedOfAction.Any())


let DateSanityCheck() =
let currentDate = DateTime.Now
match Caching.Instance.GetLastCachedData().GetLeastOldDate() with
| None -> ()
| Some date ->
if date > currentDate then
Console.Error.WriteLine(
sprintf "WARNING: detected current system date is %s, which suggests that either it's wrong or the cache data was generated in a moment with wrong future date(s) such as %s"
(currentDate |> Formatting.ShowSaneDate)
(date |> Formatting.ShowSaneDate)
)
Console.Error.Write "NOTE: it is recommended to fix this situation (by setting the current system date, or deleting the cache data folder), or the prices/rates might not update properly"
UserInteraction.PressAnyKeyToContinue()

let rec ProgramMainLoop() =
let activeAccounts = Account.GetAllActiveAccounts()
let hotAccounts =
Expand Down Expand Up @@ -450,6 +464,8 @@ let NormalStartWithNoParameters () =

let exitCode =
try
DateSanityCheck()

ProgramMainLoop ()
0
with
Expand Down

0 comments on commit 8f0e93b

Please sign in to comment.