KomodoPlatform / atomicDEX

This is the official AtomicDEX mobile (smartphone app) repository
https://atomicdex.io
GNU General Public License v2.0
10 stars 15 forks source link

warn user if local clock not in sync #133

Closed cipig closed 2 years ago

cipig commented 4 years ago

Saw couple of swaps failing because of taker_swap:541] Started_at time_dif over 60 67 and the user is retrying several times. The app should warn the user that his clock is not in sync (compare local clock with some known time source on app startup).

btw, when a swap fails like this, the node is banned

smk762 commented 4 years ago

orderbook rpc returns a timestamp (at a glance the only one to do so that doesn't involve trading). This timestamp appears to be same as device time (expressed in UTC) -

curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"RFOX\",\"rel\":\"DEX\"}"
{"askdepth":0,"asks":[],"base":"RFOX","biddepth":0,"bids":[],"netid":9999,"numasks":0,"numbids":0,"rel":"DEX","timestamp":1590664108}

vs

date +"%s"

1590664108 Orderbook rpc needs two activated coins, but so does ordering, so check could be done before trading. Check could be via gui with something like - https://pypi.org/project/ntplib/ if a py gui but probably better at protocol level via a NTP server query.

smk762 commented 4 years ago

This rust crate should work - https://crates.io/crates/sntpc

cipig commented 4 years ago

here is such a recently failed swap: https://dexapi.cipig.net/public/error.php?uuid=60180d69-3588-402b-962c-4ab0bef2b15a and another one, likely from same user: https://dexapi.cipig.net/public/error.php?uuid=c3250022-6453-4263-b6b2-d2707885569d taker_swap:649] Started_at time_dif over 60 145, so takers clock is 145s away from real time and mm2 only accepts max 60s

cipig commented 2 years ago

https://github.com/KomodoPlatform/atomicDEX-API/issues/1115