Fix for flosight changes

This commit is contained in:
sairajzero 2023-05-12 01:37:56 +05:30
parent 997066836c
commit 162dc9bcc9

View File

@ -173,19 +173,20 @@ const blockchainBond = (function () {
function refreshBlockchainData() { function refreshBlockchainData() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
compactIDB.readData("appendix", "lastTx" + floGlobals.adminID).then(lastTx => { compactIDB.readData("appendix", "lastTx" + floGlobals.adminID).then(lastTx => {
floBlockchainAPI.readData(floGlobals.adminID, { var query_options = { tx: true, filter: d => d.startsWith(blockchainBond.productStr) };
ignoreOld: lastTx, query_options.senders = floExchangeAPI.nodeList.concat(floGlobals.adminID); //sentOnly: true,
senders: floExchangeAPI.nodeList.concat(floGlobals.adminID), //sentOnly: true, if (typeof lastTx == 'number') //lastTx is tx count (*backward support)
tx: true, query_options.ignoreOld = lastTx;
filter: d => d.startsWith(blockchainBond.productStr) else if (typeof lastTx == 'string') //lastTx is txid of last tx
}).then(result => { query_options.after = lastTx;
result.data.reverse().forEach(d => { floBlockchainAPI.readData(floGlobals.adminID, query_options).then(result => {
result.items.reverse().forEach(d => {
if (d.senders.has(floGlobals.adminID) && /bond start/i.test(d.data)) if (d.senders.has(floGlobals.adminID) && /bond start/i.test(d.data))
compactIDB.addData('bonds', d.data, d.txid); compactIDB.addData('bonds', d.data, d.txid);
else else
compactIDB.addData('closings', d.data, d.txid); compactIDB.addData('closings', d.data, d.txid);
}); });
compactIDB.writeData('appendix', result.totalTxs, "lastTx" + floGlobals.adminID); compactIDB.writeData('appendix', result.lastItem, "lastTx" + floGlobals.adminID);
resolve(true); resolve(true);
}).catch(error => reject(error)) }).catch(error => reject(error))
}).catch(error => reject(error)) }).catch(error => reject(error))