mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
network stats and better client hashrate estimation
This commit is contained in:
@@ -4,7 +4,6 @@ import * as merkle from 'merkle-lib';
|
||||
import * as merkleProof from 'merkle-lib/proof';
|
||||
import { combineLatest, filter, from, interval, map, Observable, shareReplay, startWith, switchMap, tap } from 'rxjs';
|
||||
|
||||
import { IBlockTemplate } from '../models/bitcoin-rpc/IBlockTemplate';
|
||||
import { MiningJob } from '../models/MiningJob';
|
||||
import { BitcoinRpcService } from './bitcoin-rpc.service';
|
||||
|
||||
@@ -36,13 +35,10 @@ export class StratumV1JobsService {
|
||||
|
||||
public blocks: { [id: number]: IJobTemplate } = {};
|
||||
|
||||
private currentBlockTemplate$: Observable<{ blockTemplate: IBlockTemplate }>;
|
||||
|
||||
constructor(
|
||||
private readonly bitcoinRpcService: BitcoinRpcService
|
||||
) {
|
||||
|
||||
|
||||
this.newMiningJob$ = combineLatest([this.bitcoinRpcService.newBlock$, interval(60000).pipe(startWith(-1))]).pipe(
|
||||
switchMap(([miningInfo, interval]) => {
|
||||
return from(this.bitcoinRpcService.getBlockTemplate()).pipe(map((blockTemplate) => {
|
||||
@@ -102,8 +98,6 @@ export class StratumV1JobsService {
|
||||
// remove the first (coinbase) and last (root) element from the branch
|
||||
const merkle_branch = merkleBranches.slice(1, merkleBranches.length).map(b => b.toString('hex'))
|
||||
|
||||
|
||||
|
||||
block.prevHash = prevHash;
|
||||
block.version = version;
|
||||
block.bits = bits;
|
||||
|
||||
Reference in New Issue
Block a user