mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
Harden accounting and stratum production settings
This commit is contained in:
@@ -153,6 +153,10 @@ describe('ShareAccountingService', () => {
|
||||
hashRateLastHour: 114532461.2,
|
||||
bestSubmissionDifficulty: 0,
|
||||
bestSubmissionDifficultyAt: null,
|
||||
workSinceLastBlock: 0,
|
||||
currentRoundAcceptedShares: 0,
|
||||
currentRoundNetworkDifficulty: 0,
|
||||
networkDifficultyPercent: 0,
|
||||
blockCandidateCount: 0,
|
||||
latestShareAt: '2026-06-07T12:10:00.000Z',
|
||||
protocolBreakdown: [],
|
||||
@@ -274,6 +278,11 @@ describe('ShareAccountingService', () => {
|
||||
.mockResolvedValueOnce([{
|
||||
bestSubmissionDifficulty: '4096',
|
||||
bestSubmissionDifficultyAt: new Date('2026-06-07T12:19:00Z'),
|
||||
}])
|
||||
.mockResolvedValueOnce([{
|
||||
currentRoundAcceptedShares: '11',
|
||||
workSinceLastBlock: '352',
|
||||
currentRoundNetworkDifficulty: '1000',
|
||||
}]),
|
||||
};
|
||||
const service = new ShareAccountingService(repository as any, redis as any);
|
||||
@@ -284,12 +293,20 @@ describe('ShareAccountingService', () => {
|
||||
hashRateLast10Minutes: 1603451170.77,
|
||||
bestSubmissionDifficulty: 4096,
|
||||
bestSubmissionDifficultyAt: '2026-06-07T12:19:00.000Z',
|
||||
workSinceLastBlock: 352,
|
||||
currentRoundAcceptedShares: 11,
|
||||
currentRoundNetworkDifficulty: 1000,
|
||||
networkDifficultyPercent: 35.2,
|
||||
latestShareAt: '2026-06-07T12:20:00.000Z',
|
||||
}));
|
||||
expect(repository.query).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
expect.stringContaining('WHERE "blockHeight" > latest_found_block."height"'),
|
||||
);
|
||||
expect(repository.query).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
expect.stringContaining('FROM "accepted_share_block_10m"'),
|
||||
);
|
||||
});
|
||||
|
||||
it('should cache accounting summaries briefly to protect hot dashboard endpoints', async () => {
|
||||
|
||||
Reference in New Issue
Block a user