mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
fix getBlockTemplate
This commit is contained in:
@@ -98,16 +98,17 @@ export class BitcoinRpcService implements OnModuleInit {
|
|||||||
const block = await this.rpcBlockService.getBlock(blockHeight);
|
const block = await this.rpcBlockService.getBlock(blockHeight);
|
||||||
const completeBlock = block?.data != null;
|
const completeBlock = block?.data != null;
|
||||||
|
|
||||||
// If the block has already been loaded, and the same instance is fetching the template again, we just need to refresh it.
|
|
||||||
if (completeBlock && process.env.MASTER == 'true') {
|
if (completeBlock) {
|
||||||
result = await this.loadBlockTemplate(blockHeight);
|
|
||||||
}
|
|
||||||
else if (completeBlock) {
|
|
||||||
return Promise.resolve(JSON.parse(block.data));
|
return Promise.resolve(JSON.parse(block.data));
|
||||||
}else {
|
}
|
||||||
//wait for block
|
|
||||||
|
if(process.env.MASTER == 'true'){
|
||||||
|
result = await this.loadBlockTemplate(blockHeight);
|
||||||
|
}else{
|
||||||
result = await this.waitForBlock(blockHeight);
|
result = await this.waitForBlock(blockHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error getblocktemplate:', e.message);
|
console.error('Error getblocktemplate:', e.message);
|
||||||
throw new Error('Error getblocktemplate');
|
throw new Error('Error getblocktemplate');
|
||||||
|
|||||||
Reference in New Issue
Block a user