mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-04-01 00:18:49 +02:00
wrap getblockteplate try catch
This commit is contained in:
parent
7441838ba5
commit
b9c3c67531
@ -38,14 +38,19 @@ export class BitcoinRpcService {
|
||||
|
||||
|
||||
public async getBlockTemplate(): Promise<IBlockTemplate> {
|
||||
|
||||
const result: IBlockTemplate = await this.client.getblocktemplate({
|
||||
template_request: {
|
||||
rules: ['segwit'],
|
||||
mode: 'template',
|
||||
capabilities: ['serverlist', 'proposal']
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user