mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
bug
This commit is contained in:
@@ -14,9 +14,9 @@ export class AddressSettingsService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getSettings(address: string) {
|
public async getSettings(address: string, createIfNotFound: boolean) {
|
||||||
const settings = await this.addressSettingsRepository.findOne({ where: { address } });
|
const settings = await this.addressSettingsRepository.findOne({ where: { address } });
|
||||||
if (settings == null) {
|
if (createIfNotFound == true && settings == null) {
|
||||||
return await this.createNew(address);
|
return await this.createNew(address);
|
||||||
}
|
}
|
||||||
return settings;
|
return settings;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class ClientController {
|
|||||||
|
|
||||||
const workers = await this.clientService.getByAddress(address);
|
const workers = await this.clientService.getByAddress(address);
|
||||||
|
|
||||||
const addressSettings = await this.addressSettingsService.getSettings(address);
|
const addressSettings = await this.addressSettingsService.getSettings(address, false);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bestDifficulty: addressSettings?.bestDifficulty,
|
bestDifficulty: addressSettings?.bestDifficulty,
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ export class StratumV1Client {
|
|||||||
if (submissionDifficulty > this.entity.bestDifficulty) {
|
if (submissionDifficulty > this.entity.bestDifficulty) {
|
||||||
await this.clientService.updateBestDifficulty(this.extraNonceAndSessionId, submissionDifficulty);
|
await this.clientService.updateBestDifficulty(this.extraNonceAndSessionId, submissionDifficulty);
|
||||||
this.entity.bestDifficulty = submissionDifficulty;
|
this.entity.bestDifficulty = submissionDifficulty;
|
||||||
if (submissionDifficulty > (await this.addressSettingsService.getSettings(this.clientAuthorization.address)).bestDifficulty) {
|
if (submissionDifficulty > (await this.addressSettingsService.getSettings(this.clientAuthorization.address, true)).bestDifficulty) {
|
||||||
await this.addressSettingsService.updateBestDifficulty(this.clientAuthorization.address, submissionDifficulty);
|
await this.addressSettingsService.updateBestDifficulty(this.clientAuthorization.address, submissionDifficulty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user