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
5ee67bb5fe
commit
3ed6b8f5c4
@ -77,11 +77,12 @@ export class BitcoinRpcService {
|
||||
if (block != null && block.data != null) {
|
||||
return Promise.resolve(JSON.parse(block.data));
|
||||
} else if (block == null) {
|
||||
const { lockedBy } = await this.rpcBlockService.lockBlock(blockHeight, process.env.NODE_APP_INSTANCE);
|
||||
|
||||
if (lockedBy != process.env.NODE_APP_INSTANCE) {
|
||||
// There is a unique constraint on the block height so if another process tries to lock, it'll throw
|
||||
try {
|
||||
await this.rpcBlockService.lockBlock(blockHeight, process.env.NODE_APP_INSTANCE);
|
||||
} catch (e) {
|
||||
result = await this.waitForBlock(blockHeight);
|
||||
} else {
|
||||
}
|
||||
|
||||
result = await this.client.getblocktemplate({
|
||||
template_request: {
|
||||
@ -91,7 +92,7 @@ export class BitcoinRpcService {
|
||||
}
|
||||
});
|
||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
||||
}
|
||||
|
||||
} else {
|
||||
//wait for block
|
||||
result = await this.waitForBlock(blockHeight);
|
||||
|
Loading…
x
Reference in New Issue
Block a user