mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
save block
This commit is contained in:
@@ -19,7 +19,7 @@ export class RpcBlockService {
|
||||
}
|
||||
|
||||
public saveBlock(blockHeight: number, data: string) {
|
||||
return this.rpcBlockRepository.update(blockHeight, { data });
|
||||
return this.rpcBlockRepository.save( {blockHeight, data });
|
||||
}
|
||||
|
||||
public async deleteOldBlocks() {
|
||||
|
||||
@@ -135,13 +135,7 @@ export class BitcoinRpcService implements OnModuleInit {
|
||||
try{
|
||||
console.log(`Saving block ${blockHeight}`);
|
||||
const result = await this.rpcBlockService.saveBlock(blockHeight, JSON.stringify(blockTemplate));
|
||||
if(result.affected < 1){
|
||||
console.error('Block was not saved');
|
||||
console.error(result.raw);
|
||||
}else {
|
||||
console.log('block saved');
|
||||
}
|
||||
|
||||
console.log('block saved');
|
||||
}catch(e){
|
||||
console.error('Error saving block', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user