mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-03-17 13:21:43 +01:00
getBlockTemplate improvements
This commit is contained in:
parent
ad1f32cc2c
commit
fc96b9ea45
@ -93,10 +93,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}`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user