mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
tweaks
This commit is contained in:
@@ -40,14 +40,14 @@ export class SubscriptionMessage extends StratumBaseMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static refineUserAgent(userAgent: string): string {
|
public static refineUserAgent(userAgent: string): string {
|
||||||
return userAgent;
|
|
||||||
// userAgent = userAgent.split(' ')[0].split('/')[0].split('V')[0];
|
|
||||||
|
|
||||||
// if (userAgent.includes('bosminer')) {
|
|
||||||
// userAgent = 'Braiins OS';
|
|
||||||
// } else if (userAgent.includes('cpuminer')) {
|
|
||||||
// userAgent = 'cpuminer';
|
|
||||||
// }
|
|
||||||
// return userAgent;
|
// return userAgent;
|
||||||
|
userAgent = userAgent.split(' ')[0].split('/')[0].split('V')[0];
|
||||||
|
|
||||||
|
if (userAgent.includes('bosminer')) {
|
||||||
|
userAgent = 'Braiins OS';
|
||||||
|
} else if (userAgent.includes('cpuminer')) {
|
||||||
|
userAgent = 'cpuminer';
|
||||||
|
}
|
||||||
|
return userAgent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,20 +41,21 @@ export class StratumV1JobsService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly bitcoinRpcService: BitcoinRpcService
|
private readonly bitcoinRpcService: BitcoinRpcService
|
||||||
) {
|
) {
|
||||||
this.currentBlockTemplate$ = this.bitcoinRpcService.newBlock$.pipe(
|
|
||||||
switchMap((miningInfo) => {
|
|
||||||
return from(this.bitcoinRpcService.getBlockTemplate())
|
|
||||||
.pipe(map(blockTemplate => { return { miningInfo, blockTemplate } }))
|
|
||||||
}
|
|
||||||
),
|
|
||||||
shareReplay({ refCount: true, bufferSize: 1 })
|
|
||||||
);
|
|
||||||
|
|
||||||
this.newMiningJob$ = combineLatest([this.currentBlockTemplate$, interval(60000).pipe(startWith(-1))]).pipe(
|
|
||||||
map(([{ blockTemplate }, interValCount]) => {
|
this.newMiningJob$ = combineLatest([this.bitcoinRpcService.newBlock$, interval(60000).pipe(startWith(-1))]).pipe(
|
||||||
|
switchMap(([miningInfo, interval]) => {
|
||||||
|
return from(this.bitcoinRpcService.getBlockTemplate()).pipe(map((blockTemplate) => {
|
||||||
|
return {
|
||||||
|
blockTemplate,
|
||||||
|
interval
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}),
|
||||||
|
map(({ blockTemplate, interval }) => {
|
||||||
|
|
||||||
let clearJobs = false;
|
let clearJobs = false;
|
||||||
if (this.lastIntervalCount === interValCount) {
|
if (this.lastIntervalCount === interval) {
|
||||||
clearJobs = true;
|
clearJobs = true;
|
||||||
this.skipNext = true;
|
this.skipNext = true;
|
||||||
console.log('new block')
|
console.log('new block')
|
||||||
@@ -65,7 +66,7 @@ export class StratumV1JobsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastIntervalCount = interValCount;
|
this.lastIntervalCount = interval;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: blockTemplate.version,
|
version: blockTemplate.version,
|
||||||
|
|||||||
Reference in New Issue
Block a user