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> {
|
public async getBlockTemplate(): Promise<IBlockTemplate> {
|
||||||
|
let result: IBlockTemplate;
|
||||||
const result: IBlockTemplate = await this.client.getblocktemplate({
|
try {
|
||||||
template_request: {
|
result = await this.client.getblocktemplate({
|
||||||
rules: ['segwit'],
|
template_request: {
|
||||||
mode: 'template',
|
rules: ['segwit'],
|
||||||
capabilities: ['serverlist', 'proposal']
|
mode: 'template',
|
||||||
}
|
capabilities: ['serverlist', 'proposal']
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error getblocktemplate');
|
||||||
|
throw new Error('Error getblocktemplate');
|
||||||
|
}
|
||||||
console.log(`getblocktemplate tx count: ${result.transactions.length}`);
|
console.log(`getblocktemplate tx count: ${result.transactions.length}`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user