mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-03-28 18:52:16 +01:00
bug
This commit is contained in:
parent
b9af79978f
commit
5ee67bb5fe
@ -55,7 +55,7 @@ export class BitcoinRpcService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async waitForBlock(blockHeight: number) {
|
private async waitForBlock(blockHeight: number): Promise<IBlockTemplate> {
|
||||||
while (true) {
|
while (true) {
|
||||||
await new Promise(r => setTimeout(r, 100));
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
|
||||||
@ -80,21 +80,21 @@ export class BitcoinRpcService {
|
|||||||
const { lockedBy } = await this.rpcBlockService.lockBlock(blockHeight, process.env.NODE_APP_INSTANCE);
|
const { lockedBy } = await this.rpcBlockService.lockBlock(blockHeight, process.env.NODE_APP_INSTANCE);
|
||||||
|
|
||||||
if (lockedBy != process.env.NODE_APP_INSTANCE) {
|
if (lockedBy != process.env.NODE_APP_INSTANCE) {
|
||||||
await this.waitForBlock(blockHeight);
|
result = await this.waitForBlock(blockHeight);
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
result = await this.client.getblocktemplate({
|
result = await this.client.getblocktemplate({
|
||||||
template_request: {
|
template_request: {
|
||||||
rules: ['segwit'],
|
rules: ['segwit'],
|
||||||
mode: 'template',
|
mode: 'template',
|
||||||
capabilities: ['serverlist', 'proposal']
|
capabilities: ['serverlist', 'proposal']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//wait for block
|
//wait for block
|
||||||
await this.waitForBlock(blockHeight);
|
result = await this.waitForBlock(blockHeight);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user