mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
getBlockTemplate improvements
This commit is contained in:
@@ -85,10 +85,10 @@ export class BitcoinRpcService implements OnModuleInit {
|
||||
|
||||
const block = await this.rpcBlockService.getBlock(blockHeight);
|
||||
if (block != null && block.data != null) {
|
||||
console.log('promise loop resolved');
|
||||
console.log(`promise loop resolved, block height ${blockHeight}`);
|
||||
return Promise.resolve(JSON.parse(block.data));
|
||||
}
|
||||
console.log('promise loop');
|
||||
console.log(`promise loop, block height ${blockHeight}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,13 @@ export class BitcoinRpcService implements OnModuleInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
||||
|
||||
let saved = false;
|
||||
while(!saved){
|
||||
let saveResult = await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(result));
|
||||
saved = saveResult.affected > 0;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//wait for block
|
||||
|
||||
Reference in New Issue
Block a user