@@ -46,10 +46,12 @@ def list_crypto():
4646 crypto_list = []
4747 for crypto in Crypto .instances .values ():
4848 if crypto .wallet .enabled and (crypto .getstatus () != "Offline" ):
49- filtered_list .append (crypto .crypto )
50- crypto_list .append (
51- {"name" : crypto .crypto , "display_name" : crypto .display_name }
52- )
49+ if (not app .config .get ("DISABLE_CRYPTO_WHEN_LAGS" ) or
50+ (app .config .get ("DISABLE_CRYPTO_WHEN_LAGS" ) and crypto .getstatus () == "Synced" )):
51+ filtered_list .append (crypto .crypto )
52+ crypto_list .append (
53+ {"name" : crypto .crypto , "display_name" : crypto .display_name }
54+ )
5355 return {
5456 "status" : "success" ,
5557 "crypto" : filtered_list ,
@@ -81,6 +83,11 @@ def payment_request(crypto_name):
8183 "status" : "error" ,
8284 "message" : f"{ crypto_name } payment gateway is unavailable" ,
8385 }
86+ if app .config .get ("DISABLE_CRYPTO_WHEN_LAGS" ) and crypto .getstatus () != "Synced" :
87+ return {
88+ "status" : "error" ,
89+ "message" : f"{ crypto_name } payment gateway is unavailable because of lagging" ,
90+ }
8491
8592 req = request .get_json (force = True )
8693 invoice = Invoice .add (crypto = crypto , request = req )
@@ -116,6 +123,11 @@ def get_crypto_quote(crypto_name):
116123 "status" : "error" ,
117124 "message" : f"{ crypto_name } payment gateway is unavailable" ,
118125 }
126+ if app .config .get ("DISABLE_CRYPTO_WHEN_LAGS" ) and crypto .getstatus () != "Synced" :
127+ return {
128+ "status" : "error" ,
129+ "message" : f"{ crypto_name } payment gateway is unavailable because of lagging" ,
130+ }
119131
120132 req = request .get_json (force = True )
121133 fiat = req .get ("fiat" )
0 commit comments