@@ -94,6 +94,7 @@ class BitcoinRoutes {
94
94
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash' , this . getBlock )
95
95
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash/summary' , this . getStrippedBlockTransactions )
96
96
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash/audit-summary' , this . getBlockAuditSummary )
97
+ . get ( config . MEMPOOL . API_URL_PREFIX + 'blocks/tip/height' , this . getBlockTipHeight )
97
98
. post ( config . MEMPOOL . API_URL_PREFIX + 'psbt/addparents' , this . postPsbtCompletion )
98
99
. get ( config . MEMPOOL . API_URL_PREFIX + 'blocks-bulk/:from' , this . getBlocksByBulk . bind ( this ) )
99
100
. get ( config . MEMPOOL . API_URL_PREFIX + 'blocks-bulk/:from/:to' , this . getBlocksByBulk . bind ( this ) )
@@ -110,7 +111,6 @@ class BitcoinRoutes {
110
111
. get ( config . MEMPOOL . API_URL_PREFIX + 'tx/:txId/status' , this . getTransactionStatus )
111
112
. get ( config . MEMPOOL . API_URL_PREFIX + 'tx/:txId/outspends' , this . getTransactionOutspends )
112
113
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash/header' , this . getBlockHeader )
113
- . get ( config . MEMPOOL . API_URL_PREFIX + 'blocks/tip/height' , this . getBlockTipHeight )
114
114
. get ( config . MEMPOOL . API_URL_PREFIX + 'blocks/tip/hash' , this . getBlockTipHash )
115
115
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash/raw' , this . getRawBlock )
116
116
. get ( config . MEMPOOL . API_URL_PREFIX + 'block/:hash/txids' , this . getTxIdsForBlock )
@@ -589,10 +589,14 @@ class BitcoinRoutes {
589
589
}
590
590
}
591
591
592
- private async getBlockTipHeight ( req : Request , res : Response ) {
592
+ private getBlockTipHeight ( req : Request , res : Response ) {
593
593
try {
594
- const result = await bitcoinApi . $getBlockHeightTip ( ) ;
595
- res . json ( result ) ;
594
+ const result = blocks . getCurrentBlockHeight ( ) ;
595
+ if ( ! result ) {
596
+ return res . status ( 503 ) . send ( `Service Temporarily Unavailable` ) ;
597
+ }
598
+ res . setHeader ( 'content-type' , 'text/plain' ) ;
599
+ res . send ( result . toString ( ) ) ;
596
600
} catch ( e ) {
597
601
res . status ( 500 ) . send ( e instanceof Error ? e . message : e ) ;
598
602
}
0 commit comments