mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-03-27 02:02:10 +01:00
tweaks
This commit is contained in:
parent
978fc7cd1a
commit
a7ea61f28f
@ -40,14 +40,14 @@ export class SubscriptionMessage extends StratumBaseMessage {
|
||||
}
|
||||
|
||||
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;
|
||||
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(
|
||||
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;
|
||||
if (this.lastIntervalCount === interValCount) {
|
||||
if (this.lastIntervalCount === interval) {
|
||||
clearJobs = true;
|
||||
this.skipNext = true;
|
||||
console.log('new block')
|
||||
@ -65,7 +66,7 @@ export class StratumV1JobsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.lastIntervalCount = interValCount;
|
||||
this.lastIntervalCount = interval;
|
||||
|
||||
return {
|
||||
version: blockTemplate.version,
|
||||
|
Loading…
x
Reference in New Issue
Block a user