@@ -28,23 +28,25 @@ export const StatusRoutes: FastifyPluginAsync<
28
28
status : 'ready' ,
29
29
} ;
30
30
try {
31
- const poxForceUnlockHeights = await fastify . db . getPoxForceUnlockHeights ( ) ;
32
- if ( poxForceUnlockHeights . found ) {
33
- response . pox_v1_unlock_height = poxForceUnlockHeights . result . pox1UnlockHeight as number ;
34
- response . pox_v2_unlock_height = poxForceUnlockHeights . result . pox2UnlockHeight as number ;
35
- response . pox_v3_unlock_height = poxForceUnlockHeights . result . pox3UnlockHeight as number ;
36
- }
37
- const chainTip = await fastify . db . getChainTip ( fastify . db . sql ) ;
38
- if ( chainTip . block_height > 0 ) {
39
- response . chain_tip = {
40
- block_height : chainTip . block_height ,
41
- block_hash : chainTip . block_hash ,
42
- index_block_hash : chainTip . index_block_hash ,
43
- microblock_hash : chainTip . microblock_hash ,
44
- microblock_sequence : chainTip . microblock_sequence ,
45
- burn_block_height : chainTip . burn_block_height ,
46
- } ;
47
- }
31
+ await fastify . db . sqlTransaction ( async sql => {
32
+ const poxForceUnlockHeights = await fastify . db . getPoxForcedUnlockHeightsInternal ( sql ) ;
33
+ if ( poxForceUnlockHeights . found ) {
34
+ response . pox_v1_unlock_height = poxForceUnlockHeights . result . pox1UnlockHeight as number ;
35
+ response . pox_v2_unlock_height = poxForceUnlockHeights . result . pox2UnlockHeight as number ;
36
+ response . pox_v3_unlock_height = poxForceUnlockHeights . result . pox3UnlockHeight as number ;
37
+ }
38
+ const chainTip = await fastify . db . getChainTip ( sql ) ;
39
+ if ( chainTip . block_height > 0 ) {
40
+ response . chain_tip = {
41
+ block_height : chainTip . block_height ,
42
+ block_hash : chainTip . block_hash ,
43
+ index_block_hash : chainTip . index_block_hash ,
44
+ microblock_hash : chainTip . microblock_hash ,
45
+ microblock_sequence : chainTip . microblock_sequence ,
46
+ burn_block_height : chainTip . burn_block_height ,
47
+ } ;
48
+ }
49
+ } ) ;
48
50
} catch ( error ) {
49
51
// ignore error
50
52
}
0 commit comments