mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
bug
This commit is contained in:
@@ -55,7 +55,7 @@ export class BitcoinRpcService {
|
||||
}
|
||||
}
|
||||
|
||||
private async waitForBlock(blockHeight: number) {
|
||||
private async waitForBlock(blockHeight: number): Promise<IBlockTemplate> {
|
||||
while (true) {
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
|
||||
@@ -80,9 +80,8 @@ export class BitcoinRpcService {
|
||||
const { lockedBy } = await this.rpcBlockService.lockBlock(blockHeight, process.env.NODE_APP_INSTANCE);
|
||||
|
||||
if (lockedBy != process.env.NODE_APP_INSTANCE) {
|
||||
await this.waitForBlock(blockHeight);
|
||||
return;
|
||||
}
|
||||
result = await this.waitForBlock(blockHeight);
|
||||
} else {
|
||||
|
||||
result = await this.client.getblocktemplate({
|
||||
template_request: {
|
||||
@@ -92,9 +91,10 @@ export class BitcoinRpcService {
|
||||
}
|
||||
});
|
||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
||||
}
|
||||
} else {
|
||||
//wait for block
|
||||
await this.waitForBlock(blockHeight);
|
||||
result = await this.waitForBlock(blockHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user