mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
taproot
This commit is contained in:
@@ -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}`);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user