This commit is contained in:
Ben Wilson
2023-07-31 09:12:58 -04:00
parent 432f5c4325
commit 3a1ae6bf09
6 changed files with 49 additions and 8 deletions
+6
View File
@@ -1,7 +1,9 @@
import { ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import * as bitcoinjs from 'bitcoinjs-lib';
import { useContainer } from 'class-validator';
import * as ecc from 'tiny-secp256k1';
import { AppModule } from './app.module';
@@ -25,6 +27,10 @@ async function bootstrap() {
);
app.enableCors();
useContainer(app.select(AppModule), { fallbackOnErrors: true });
//Taproot
bitcoinjs.initEccLib(ecc);
await app.listen(process.env.PORT, '0.0.0.0', () => {
console.log(`http listening on port ${process.env.PORT}`);
});
+1 -3
View File
@@ -62,8 +62,6 @@ export class MiningJob {
const testBlock = Object.assign(new bitcoinjs.Block(), jobTemplate.block);
testBlock.transactions[0] = this.coinbaseTransaction;
testBlock.nonce = nonce;
@@ -84,7 +82,7 @@ export class MiningJob {
testBlock.timestamp = timestamp;
return testBlock as any;
return testBlock;
}
+7 -5
View File
@@ -287,11 +287,13 @@ export class StratumV1Client extends EasyUnsubscribe {
this.stratumV1JobsService.newMiningJob$.pipe(
takeUntil(this.easyUnsubscribe)
).subscribe(async (jobTemplate) => {
await this.sendNewMiningJob(jobTemplate);
await this.checkDifficulty();
await this.watchdog();
try {
await this.sendNewMiningJob(jobTemplate);
await this.checkDifficulty();
await this.watchdog();
} catch (e) {
this.promiseSocket.socket.emit('end', true);
}
});
}