- continuation of funds not storing correctly in IDB
This commit is contained in:
sairajzero 2021-05-13 20:25:44 +05:30
parent a546e216bf
commit 6d0b5a7d95

View File

@ -10631,33 +10631,32 @@ Bitcoin.Util = {
txid: true, txid: true,
filter: d => d.startsWith(floGlobals.productStr) filter: d => d.startsWith(floGlobals.productStr)
}).then(result => { }).then(result => {
Promise.all(result.data.reverse().map(d => new Promise((res, rej) => { compactIDB.searchData("funds", {
if (/continue: /i.test(d[1])) { lowerKey: floID + "|",
let ctx = d[1].match(/continue: [0-9a-z]{64}/i).toString().split(": ")[1]; upperKey: floID + "||"
console.info(floID + "|" + ctx) }).then(funds => {
compactIDB.readData('funds', floID + "|" + ctx).then(fd => { let writeKeys = new Set();
fd.push({ result.data.reverse().forEach(d => {
if (/continue: /i.test(d[1])) {
let ctx = d[1].match(/continue: [0-9a-z]{64}/i).toString().split(": ")[1];
funds[floID + "|" + ctx].push({
txid: d[0], txid: d[0],
data: d[1] data: d[1]
}) })
compactIDB.writeData('funds', fd, floID + "|" + ctx) writeKeys.add(floID + "|" + ctx);
.then(r => res([floID + "|" + ctx, fd])) } else {
.catch(e => rej(e)) funds[floID + "|" + d[0]] = [{
}).catch(error => rej(error)) txid: d[0],
} else { data: d[1]
let fd = [{ }]
txid: d[0], writeKeys.add(floID + "|" + d[0]);
data: d[1] }
}] })
compactIDB.addData('funds', fd, floID + "|" + d[0]) writeKeys = Array.from(writeKeys);
.then(r => res([floID + "|" + d[0], fd])) Promise.all(writeKeys.map(k => compactIDB.writeData("funds", funds[k], k))).then(results => {
.catch(e => rej(e)) compactIDB.writeData('appendix', result.totalTxs, "lastTx|" + floID);
} resolve(writeKeys.map(k => funds[k]))
}))).then(results => { }).catch(error => reject(error))
compactIDB.writeData('appendix', result.totalTxs, "lastTx|" + floID);
let data = {};
results.forEach(r => data[r[0]] = r[1])
resolve(data);
}).catch(error => reject(error)) }).catch(error => reject(error))
}).catch(error => reject(error)) }).catch(error => reject(error))
}).catch(error => reject(error)) }).catch(error => reject(error))