Loading app/lib/computation/QuickSync.ts +17 −15 Original line number Diff line number Diff line Loading @@ -123,11 +123,8 @@ export class QuickSynchronizer { const local_cindex = Indexer.cindex(index); const local_sindex = Indexer.sindex(index); const local_mindex = Indexer.mindex(index); sync_iindex = sync_iindex.concat(local_iindex); sync_cindex = sync_cindex.concat(local_cindex); sync_mindex = sync_mindex.concat(local_mindex); const HEAD = await Indexer.quickCompleteGlobalScope(block, sync_currConf, sync_bindex, sync_iindex, sync_mindex, sync_cindex, { const HEAD = await Indexer.quickCompleteGlobalScope(block, sync_currConf, sync_bindex, local_iindex, local_mindex, local_cindex, { getBlock: (number: number) => { return Promise.resolve(sync_allBlocks[number]); }, Loading Loading @@ -184,12 +181,12 @@ export class QuickSynchronizer { await this.dal.iindexDAL.insertBatch(sync_iindex); await this.dal.sindexDAL.insertBatch(sync_sindex); await this.dal.cindexDAL.insertBatch(sync_cindex); sync_mindex = []; sync_iindex = []; sync_cindex = []; sync_sindex = local_sindex; sync_iindex = local_iindex sync_cindex = local_cindex sync_mindex = local_mindex sync_sindex = local_sindex sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGenDividend(HEAD, this.dal)); sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGenDividend(HEAD, local_iindex, this.dal)); sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGarbageSmallAccounts(HEAD, sync_sindex, sync_memoryDAL)); if (nextExpiringChanged) { sync_cindex = sync_cindex.concat(await Indexer.ruleIndexGenCertificationExpiry(HEAD, this.dal)); Loading @@ -201,21 +198,26 @@ export class QuickSynchronizer { // Update balances with UD + local garbagings await this.blockchain.updateWallets(sync_sindex, sync_memoryDAL) // --> Update links await this.dal.updateWotbLinks(local_cindex.concat(sync_cindex)); // Flush the INDEX again await this.dal.mindexDAL.insertBatch(sync_mindex); // Flush the INDEX again (needs to be done *before* the update of wotb links because of block#0) await this.dal.iindexDAL.insertBatch(sync_iindex); await this.dal.mindexDAL.insertBatch(sync_mindex); await this.dal.sindexDAL.insertBatch(sync_sindex); await this.dal.cindexDAL.insertBatch(sync_cindex); sync_mindex = []; // --> Update links await this.dal.updateWotbLinks(local_cindex.concat(sync_cindex)); sync_iindex = []; sync_mindex = []; sync_cindex = []; sync_sindex = []; // Create/Update nodes in wotb await this.blockchain.updateMembers(block, this.dal) } else { // Concat the results to the pending data sync_iindex = sync_iindex.concat(local_iindex); sync_cindex = sync_cindex.concat(local_cindex); sync_mindex = sync_mindex.concat(local_mindex); } // Trim the bindex Loading app/lib/dal/fileDAL.ts +1 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import {DBBlock} from "../db/DBBlock" import {DBMembership} from "./sqliteDAL/MembershipDAL" import {MerkleDTO} from "../dto/MerkleDTO" import {CommonConstants} from "../common-libs/constants" import { ProxiesConf } from '../proxy'; import {PowDAL} from "./fileDALs/PowDAL"; const fs = require('fs') Loading Loading @@ -697,7 +696,7 @@ export class FileDAL { let iindex = indexer.iindex(index); let sindex = indexer.sindex(index); let cindex = indexer.cindex(index); sindex = sindex.concat(await indexer.ruleIndexGenDividend(HEAD, this)); sindex = sindex.concat(await indexer.ruleIndexGenDividend(HEAD, iindex, this)); sindex = sindex.concat(await indexer.ruleIndexGarbageSmallAccounts(HEAD, sindex, this)); cindex = cindex.concat(await indexer.ruleIndexGenCertificationExpiry(HEAD, this)); mindex = mindex.concat(await indexer.ruleIndexGenMembershipExpiry(HEAD, this)); Loading app/lib/indexer.ts +2 −2 Original line number Diff line number Diff line Loading @@ -1542,10 +1542,10 @@ export class Indexer { } // BR_G91 static async ruleIndexGenDividend(HEAD: DBHead, dal: any) { static async ruleIndexGenDividend(HEAD: DBHead, local_iindex: IindexEntry[], dal: any) { const dividends = []; if (HEAD.new_dividend) { const members = await dal.iindexDAL.getMembersPubkeys() const members = (await dal.iindexDAL.getMembersPubkeys()).concat(local_iindex.filter(i => i.member)) for (const MEMBER of members) { dividends.push({ op: 'CREATE', Loading doc/Protocol.md +15 −0 Original line number Diff line number Diff line Loading @@ -2678,6 +2678,21 @@ For each `REDUCE_BY(GLOBAL_IINDEX[member=true], 'pub') as IDTY` then if `IDTY.me consumed = false ) For each `LOCAL_IINDEX[member=true] as IDTY` add a new LOCAL_SINDEX entry: SINDEX ( op = 'CREATE' identifier = IDTY.pub pos = HEAD.number written_on = BLOCKSTAMP written_time = MedianTime amount = HEAD.dividend base = HEAD.unitBase locktime = null conditions = REQUIRE_SIG(MEMBER.pub) consumed = false ) ###### BR_G106 - Low accounts Set: Loading Loading
app/lib/computation/QuickSync.ts +17 −15 Original line number Diff line number Diff line Loading @@ -123,11 +123,8 @@ export class QuickSynchronizer { const local_cindex = Indexer.cindex(index); const local_sindex = Indexer.sindex(index); const local_mindex = Indexer.mindex(index); sync_iindex = sync_iindex.concat(local_iindex); sync_cindex = sync_cindex.concat(local_cindex); sync_mindex = sync_mindex.concat(local_mindex); const HEAD = await Indexer.quickCompleteGlobalScope(block, sync_currConf, sync_bindex, sync_iindex, sync_mindex, sync_cindex, { const HEAD = await Indexer.quickCompleteGlobalScope(block, sync_currConf, sync_bindex, local_iindex, local_mindex, local_cindex, { getBlock: (number: number) => { return Promise.resolve(sync_allBlocks[number]); }, Loading Loading @@ -184,12 +181,12 @@ export class QuickSynchronizer { await this.dal.iindexDAL.insertBatch(sync_iindex); await this.dal.sindexDAL.insertBatch(sync_sindex); await this.dal.cindexDAL.insertBatch(sync_cindex); sync_mindex = []; sync_iindex = []; sync_cindex = []; sync_sindex = local_sindex; sync_iindex = local_iindex sync_cindex = local_cindex sync_mindex = local_mindex sync_sindex = local_sindex sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGenDividend(HEAD, this.dal)); sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGenDividend(HEAD, local_iindex, this.dal)); sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGarbageSmallAccounts(HEAD, sync_sindex, sync_memoryDAL)); if (nextExpiringChanged) { sync_cindex = sync_cindex.concat(await Indexer.ruleIndexGenCertificationExpiry(HEAD, this.dal)); Loading @@ -201,21 +198,26 @@ export class QuickSynchronizer { // Update balances with UD + local garbagings await this.blockchain.updateWallets(sync_sindex, sync_memoryDAL) // --> Update links await this.dal.updateWotbLinks(local_cindex.concat(sync_cindex)); // Flush the INDEX again await this.dal.mindexDAL.insertBatch(sync_mindex); // Flush the INDEX again (needs to be done *before* the update of wotb links because of block#0) await this.dal.iindexDAL.insertBatch(sync_iindex); await this.dal.mindexDAL.insertBatch(sync_mindex); await this.dal.sindexDAL.insertBatch(sync_sindex); await this.dal.cindexDAL.insertBatch(sync_cindex); sync_mindex = []; // --> Update links await this.dal.updateWotbLinks(local_cindex.concat(sync_cindex)); sync_iindex = []; sync_mindex = []; sync_cindex = []; sync_sindex = []; // Create/Update nodes in wotb await this.blockchain.updateMembers(block, this.dal) } else { // Concat the results to the pending data sync_iindex = sync_iindex.concat(local_iindex); sync_cindex = sync_cindex.concat(local_cindex); sync_mindex = sync_mindex.concat(local_mindex); } // Trim the bindex Loading
app/lib/dal/fileDAL.ts +1 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import {DBBlock} from "../db/DBBlock" import {DBMembership} from "./sqliteDAL/MembershipDAL" import {MerkleDTO} from "../dto/MerkleDTO" import {CommonConstants} from "../common-libs/constants" import { ProxiesConf } from '../proxy'; import {PowDAL} from "./fileDALs/PowDAL"; const fs = require('fs') Loading Loading @@ -697,7 +696,7 @@ export class FileDAL { let iindex = indexer.iindex(index); let sindex = indexer.sindex(index); let cindex = indexer.cindex(index); sindex = sindex.concat(await indexer.ruleIndexGenDividend(HEAD, this)); sindex = sindex.concat(await indexer.ruleIndexGenDividend(HEAD, iindex, this)); sindex = sindex.concat(await indexer.ruleIndexGarbageSmallAccounts(HEAD, sindex, this)); cindex = cindex.concat(await indexer.ruleIndexGenCertificationExpiry(HEAD, this)); mindex = mindex.concat(await indexer.ruleIndexGenMembershipExpiry(HEAD, this)); Loading
app/lib/indexer.ts +2 −2 Original line number Diff line number Diff line Loading @@ -1542,10 +1542,10 @@ export class Indexer { } // BR_G91 static async ruleIndexGenDividend(HEAD: DBHead, dal: any) { static async ruleIndexGenDividend(HEAD: DBHead, local_iindex: IindexEntry[], dal: any) { const dividends = []; if (HEAD.new_dividend) { const members = await dal.iindexDAL.getMembersPubkeys() const members = (await dal.iindexDAL.getMembersPubkeys()).concat(local_iindex.filter(i => i.member)) for (const MEMBER of members) { dividends.push({ op: 'CREATE', Loading
doc/Protocol.md +15 −0 Original line number Diff line number Diff line Loading @@ -2678,6 +2678,21 @@ For each `REDUCE_BY(GLOBAL_IINDEX[member=true], 'pub') as IDTY` then if `IDTY.me consumed = false ) For each `LOCAL_IINDEX[member=true] as IDTY` add a new LOCAL_SINDEX entry: SINDEX ( op = 'CREATE' identifier = IDTY.pub pos = HEAD.number written_on = BLOCKSTAMP written_time = MedianTime amount = HEAD.dividend base = HEAD.unitBase locktime = null conditions = REQUIRE_SIG(MEMBER.pub) consumed = false ) ###### BR_G106 - Low accounts Set: Loading