mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-04-02 08:58:02 +02:00
loadBlockTemplate
This commit is contained in:
parent
717a5c7878
commit
c1ab6a152e
@ -118,6 +118,8 @@ export class BitcoinRpcService implements OnModuleInit {
|
||||
|
||||
private async loadBlockTemplate(blockHeight: number) {
|
||||
|
||||
console.log(`Master fetching block ${blockHeight}`);
|
||||
|
||||
let blockTemplate: IBlockTemplate;
|
||||
while (blockTemplate == null) {
|
||||
blockTemplate = await this.client.getblocktemplate({
|
||||
@ -129,8 +131,13 @@ export class BitcoinRpcService implements OnModuleInit {
|
||||
});
|
||||
}
|
||||
|
||||
try{
|
||||
console.log(`Saving block ${blockHeight}`);
|
||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(blockTemplate));
|
||||
|
||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(blockTemplate));
|
||||
}catch(e){
|
||||
console.log('Error saving block', e.message);
|
||||
}
|
||||
|
||||
return blockTemplate;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user