diff --git a/migrations/1673632140730_pox_state_fix.js b/migrations/1673632140730_pox_state_fix.js new file mode 100644 index 00000000..0f522f2b --- /dev/null +++ b/migrations/1673632140730_pox_state_fix.js @@ -0,0 +1,15 @@ +/** @param { import("node-pg-migrate").MigrationBuilder } pgm */ +exports.up = pgm => { + + pgm.alterColumn('pox_state', 'pox_v1_unlock_height', { + type: 'bigint' + }); + +} + +/** @param { import("node-pg-migrate").MigrationBuilder } pgm */ +exports.down = pgm => { + pgm.alterColumn('pox_state', 'pox_v1_unlock_height', { + type: 'integer' + }); +} diff --git a/src/datastore/pg-store.ts b/src/datastore/pg-store.ts index 7787a8f3..73dc9571 100644 --- a/src/datastore/pg-store.ts +++ b/src/datastore/pg-store.ts @@ -351,7 +351,7 @@ export class PgStore { } async getPox1UnlockHeightInternal(sql: PgSqlClient): Promise> { - const query = await sql<{ pox_v1_unlock_height: number }[]>` + const query = await sql<{ pox_v1_unlock_height: string }[]>` SELECT pox_v1_unlock_height FROM pox_state LIMIt 1 @@ -359,7 +359,7 @@ export class PgStore { if (query.length === 0) { return { found: false }; } - const unlockHeight = query[0].pox_v1_unlock_height; + const unlockHeight = parseInt(query[0].pox_v1_unlock_height); if (unlockHeight === 0) { return { found: false }; }