Rotation queue: reconcile against live chain directs in normalizeStatuses - never activate a sponsor the chain says is already 2/2 qualified (also syncs stale direct counts upward)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-19 14:37:48 -05:00
parent dd6644bc3b
commit 6ebe436cf3
2 changed files with 19 additions and 1 deletions
+8 -1
View File
@@ -667,6 +667,13 @@ function getOrgShare(rootId) {
};
}
// Live direct count from the index (null when unknown) — used by the rotation
// queue to reconcile against chain reality before activating a sponsor.
function liveDirects(id) {
if (!state || !state.members[id]) return null;
return state.members[id].directCount || 0;
}
// Wallet address -> position id (for wallet-verified messaging sign-in).
// One position per address by contract design.
function memberIdByAccount(address) {
@@ -744,4 +751,4 @@ async function getIncome(id) {
};
}
module.exports = { startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, nextOpenPosition, memberIdByAccount, balanceOf, CONTRACT };
module.exports = { startIndexer, getPayoutsPublic, verifyMember, memberLookup, memberPublic, getIncome, getOwnerUpgradeNeeds, getOrgRouting, getOrgShare, getCoachingScan, getMatrixTree, isInTeam, nextOpenPosition, memberIdByAccount, liveDirects, balanceOf, CONTRACT };