mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
wrap getblockteplate try catch
This commit is contained in:
@@ -38,14 +38,19 @@ export class BitcoinRpcService {
|
||||
|
||||
|
||||
public async getBlockTemplate(): Promise<IBlockTemplate> {
|
||||
|
||||
const result: IBlockTemplate = await this.client.getblocktemplate({
|
||||
let result: IBlockTemplate;
|
||||
try {
|
||||
result = await this.client.getblocktemplate({
|
||||
template_request: {
|
||||
rules: ['segwit'],
|
||||
mode: 'template',
|
||||
capabilities: ['serverlist', 'proposal']
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Error getblocktemplate');
|
||||
throw new Error('Error getblocktemplate');
|
||||
}
|
||||
console.log(`getblocktemplate tx count: ${result.transactions.length}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user