Hub switch-on (Marty 2026-11-14). Rule 2: a hub arrival gets person.locks.linkspin's sponsor when the LinkSpin contract holds them, never the plain network sponsor; sponsor.changed stays ignored. Quiet: a wallet filled from a hub event never switches payouts on (isQuiet: no gas, no lock, no 'payouts are switched on' mail). Rule 3: the holding tank (waiting, release, expiry, rescue, readyTick, autoAssign) leaves out anyone the hub reports locked on any contract or sponsored, and hub waiting copies that never signed in here; /v1/locked detail cached 10 min, last answer kept 1 h, after that held (unknown). Alignment to the hub sponsor only with HUB_TANK_ALIGN=on. Needs network-hub b44dba6. hubsync 15 checks, sponsorfollow 30/30, tank-cap 15/15, networksso ALL PASSED, tank-hold, carry-hold ok

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-14 08:45:43 -06:00
parent 5fbaf4f17d
commit 42cbe96979
4 changed files with 212 additions and 19 deletions
+5 -2
View File
@@ -733,7 +733,7 @@ async function boot() {
setInterval(() => follow.retryPending().catch(e => console.error('sponsorfollow retry', e.message)), 2 * 60 * 1000);
// payouts on the moment a wallet is linked (Marty, 2026-10-17); the engine pays the gas, sponsors above are activated first.
// Not while a deliberate sponsor change from InstantAdPay is still waiting to be applied (afterResolve above does it then).
accounts.onWalletLinked(async email => { if (followStore.pendingFor(email)) { console.log('activation deferred: sponsor follow pending for', email); return; } const a = await accounts.byEmail(email); if (a && a.address) await carry.ensureOnChain(a, 0, 'wallet'); });
accounts.onWalletLinked(async email => { if (hubsync.isQuiet(email)) { console.log('activation skipped: wallet filled from a network hub event (quiet)'); return; } if (followStore.pendingFor(email)) { console.log('activation deferred: sponsor follow pending for', email); return; } const a = await accounts.byEmail(email); if (a && a.address) await carry.ensureOnChain(a, 0, 'wallet'); });
// member numbers for accounts the engine activated before 2026-10-18 (the ledger names people by them); 60 s after boot so a deploy's old copy is gone
setTimeout(() => carry.backfillMemberIds().then(r => console.log('memberId backfill', JSON.stringify(r))).catch(e => console.error('memberId backfill', e.message)), 60000);
// reverse registry sync (2026-10-15): account changes reach InstantAdPay within seconds; a 2-minute reconcile catches the rest
@@ -767,7 +767,10 @@ async function boot() {
tank.init({ capOpen: () => siteConfig().tankAdoptCap, dataDir: DATA_DIR, chain, accounts, messages, mailer, site: SITE_URL, follow, store: followStore,
// network alignment + activation hold + 24-hour safety net (2026-10-27): a tank member's plain activation is never
// bound under the fallback position; their InstantAdPay sponsor first, else an adopter (a purchase is never held)
hooks: { network: (email, address) => networkSponsor(email, address), prefetch: emails => iapFacts(emails, { timeout: 20000 }),
// network hub rule 3 (2026-11-14, only with HUB_ENABLED): the hub's sponsor comes first for alignment, and nobody it reports
// locked on a network contract or sponsored is offered, moved to the tank or auto-assigned (hubsync.js: cache + fail-safe)
hooks: { network: async (email, address) => (hubsync.on() ? await hubsync.hubSponsor(email).catch(() => null) : null) || networkSponsor(email, address), prefetch: emails => iapFacts(emails, { timeout: 20000 }),
networkHeld: accts => (hubsync.on() ? hubsync.heldAmong(accts) : new Map()), networkLocked: email => (hubsync.on() ? hubsync.lockedAnywhere(email) : null),
iapOwns: (email, o) => iapOwnsTank(email, o), bound: async a => { const id = Number(await chain.memberIdByAccount(a.address)) || 0; if (id) await accounts.setMemberId(a.email, id).catch(() => {}); return id; },
payoutBlocked: id => payoutChainBlocked(id, 2), companyId: () => Number(siteConfig().defaultSponsorId) || 1,
notify: (email, subject, text) => messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [email], subject, '<p>' + String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/(https:\/\/[^\s)]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>') + '</p>'),