@@ -107,7 +107,6 @@ function get_requeststates(trigger, active_requests) {
107
107
requeststates = statuscache . requeststates ;
108
108
if ( cachetime > 30000 || empty_obj ( requeststates ) ) { //check if cached crypto rates are expired (check every 30 seconds on page refresh or when opening request page)
109
109
active_requests . addClass ( "scan" ) ;
110
- br_remove_session ( "txstatus" ) ; // remove cached transactions
111
110
getinputs ( request_data , d_lay ) ;
112
111
return
113
112
}
@@ -138,19 +137,30 @@ function get_requeststates(trigger, active_requests) {
138
137
return
139
138
}
140
139
if ( ! empty_obj ( glob_let . statuspush ) ) {
140
+ const tx_states = br_get_session ( "txstatus" , true ) ;
141
+ if ( tx_states ) {
142
+ const txs = tx_states . requeststates ,
143
+ txid = sha_sub ( JSON . stringify ( txs ) , 15 ) , // hash arrays to compare for changes
144
+ new_tx_id = sha_sub ( JSON . stringify ( glob_let . statuspush ) , 15 ) ;
145
+ if ( txid !== new_tx_id ) { // check for updates
146
+ // Only save on status updates
147
+ saverequests ( ) ;
148
+ }
149
+ } else {
150
+ saverequests ( ) ;
151
+ }
141
152
const statusobject = {
142
153
"timestamp" : now ( ) ,
143
154
"requeststates" : glob_let . statuspush
144
155
} ;
145
156
br_set_session ( "txstatus" , statusobject , true ) ;
146
- saverequests ( ) ;
147
157
clearscan ( ) ;
148
158
}
149
159
}
150
160
151
161
// Retrieves input data for requests
152
162
function getinputs ( rd , dl ) {
153
- const rdo = tx_data ( rd ) ; // fetchblocks.js
163
+ const rdo = tx_data ( rd ) ;
154
164
if ( rdo . pending === "scanning" || rdo . pending === "polling" ) {
155
165
if ( dl ) {
156
166
const delay = 10000 ,
@@ -174,7 +184,7 @@ function getinputs(rd, dl) {
174
184
const transactionlist = rdo . transactionlist ;
175
185
if ( transactionlist ) {
176
186
transactionlist . find ( "li" ) . each ( function ( i ) {
177
- glob_let . tx_list . push ( $ ( this ) . data ( "txhash" ) ) ;
187
+ glob_let . tx_list . push ( $ ( this ) . data ( "txhash" ) ) ; //index transaction id's
178
188
} ) ;
179
189
api_callback ( rdo ) ;
180
190
}
@@ -221,6 +231,11 @@ function continue_select(rd, api_data, rdo) {
221
231
222
232
function continue_select_api ( rd , api_data , rdo ) {
223
233
const api_name = api_data . name ;
234
+ if ( rdo . source === "addr_polling" ) {
235
+ glob_let . rpc_attempts = { }
236
+ continue_select ( rd , api_data , rdo ) ;
237
+ return
238
+ }
224
239
if ( api_name === "mymonero api" ) {
225
240
monero_fetch_init ( rd , api_data , rdo ) ;
226
241
return
@@ -265,11 +280,6 @@ function continue_select_api(rd, api_data, rdo) {
265
280
insight_fetch_dash ( rd , api_data , rdo ) ;
266
281
return
267
282
}
268
- if ( rdo . source === "addr_polling" ) {
269
- glob_let . rpc_attempts = { }
270
- continue_select ( rd , api_data , rdo ) ;
271
- return
272
- }
273
283
api_callback ( rdo ) ;
274
284
}
275
285
@@ -417,6 +427,7 @@ function handle_rpc_fails(rd, rdo, error_obj, api_data, l2) {
417
427
error_data = get_api_error_data ( error_obj ) ,
418
428
timeout = rdo . timeout ,
419
429
cachetime = rdo . cachetime ;
430
+
420
431
function next_proxy ( type ) { // try next proxy
421
432
if ( type === "api_fail" && ( error_data . apikey || glob_let . apikey_fails ) ) return false ; // only try next proxy if api key is expired or missing
422
433
if ( get_next_proxy ( ) ) {
@@ -745,8 +756,9 @@ function data_title(dat) {
745
756
lc_val = dat . ccval * lc_ccrate ,
746
757
cc_upper = dat . ccsymbol ? dat . ccsymbol . toUpperCase ( ) : dat . ccsymbol ,
747
758
lc_upper = lcsymbol ? lcsymbol . toUpperCase ( ) : lcsymbol ,
748
- localrate = lc_upper === "USD" ? "" : cc_upper + "-" + lc_upper + ": " + lc_ccrate . toFixed ( 6 ) + "\n" + lc_upper + "-USD: " + lc_usd_rate . toFixed ( 2 ) ,
749
- historic_dat = "Historic data (" + fulldateformat ( new Date ( timestamp - glob_const . timezone ) , langcode ) + "):\n" +
759
+ localrate = lc_upper === "USD" ? "" : cc_upper + "-" + lc_upper + ": " + lc_ccrate . toFixed ( 6 ) + "\n" + lc_upper + "-USD: " + lc_usd_rate . toFixed ( 2 ) ;
760
+ // set historic data
761
+ historic_dat = "Historic data (" + fulldateformat ( new Date ( timestamp - glob_const . timezone ) , langcode ) + "):\n" +
750
762
"Fiatvalue: " + lc_val . toFixed ( 2 ) + " " + lc_upper + "\n" +
751
763
cc_upper + "-USD: " + price . toFixed ( 6 ) + "\n" +
752
764
localrate + "\n" +
0 commit comments