observer: the subsidy and paid amounts as numeric, not bigint (the Igneum 2.0 chain reports them in wei: 9.52 IGN = 9522644482386090276, past int64; the dn4_ observer on build-1 dropped every block insert until the box copy was widened 17:25 BST)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-08 16:26:17 +00:00
parent 835dabcf2d
commit e2b803257d

View file

@ -109,6 +109,9 @@ async function setupSchema() {
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS proof_records int`,
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS subsidy_sompi bigint`,
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS paid_sompi bigint`,
// wei-scale amounts on the Igneum 2.0 chain (8 Oct 2026): widen both in place, a no-op once numeric
`ALTER TABLE ${TB} ALTER COLUMN subsidy_sompi TYPE numeric(40,0)`,
`ALTER TABLE ${TB} ALTER COLUMN paid_sompi TYPE numeric(40,0)`,
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS selected_parent text`,
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS number bigint`,
`ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS detail jsonb`,
@ -503,7 +506,8 @@ async function flushBlocks() {
const rows = pendingBlocks.splice(0, 200);
const cols = ['hash', 'blue_score', 'daa_score', 'timestamp_ms', 'parents', 'parent_hashes', 'is_chain_block', 'vote_key_hash', 'miner_address', 'engine',
'tx_count', 'evm_miner', 'proof_records', 'subsidy_sompi', 'paid_sompi', 'selected_parent', 'detail'];
const cast = { parent_hashes: '::text[]', detail: '::jsonb', subsidy_sompi: '::bigint', paid_sompi: '::bigint' };
// numeric, not bigint: the Igneum 2.0 chain reports the subsidy and the paid amount in wei (9.52 IGN = 9522644482386090276, past int64; 8 Oct 2026)
const cast = { parent_hashes: '::text[]', detail: '::jsonb', subsidy_sompi: '::numeric', paid_sompi: '::numeric' };
const params = []; const values = [];
for (const r of rows) {
const ph = [];