Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[alstr] Fix with Decker's change #43

Open
github-actions bot opened this issue Sep 14, 2024 · 0 comments
Open

[alstr] Fix with Decker's change #43

github-actions bot opened this issue Sep 14, 2024 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link

//TODO(alstr): Fix with Decker's change

        };
        var submitTime = Date.now() / 1000 | 0;
        var job = this.validJobs[jobId];
        if (typeof job === 'undefined' || job.jobId != jobId) {
            return shareError([21, 'job not found']);
        }
        if (nTime.length !== 8) {
            return shareError([20, 'incorrect size of ntime']);
        }
        //TODO(alstr): Fix with Decker's change
        let nTimeInt = parseInt(nTime.substr(6, 2) + nTime.substr(4, 2) + nTime.substr(2, 2) + nTime.substr(0, 2), 16);
        if (Number.isNaN(nTimeInt)) {
            return shareError([20, 'invalid ntime'])
        }
        if (nTimeInt < job.rpcData.curtime || nTimeInt > submitTime + 7200) {
            return shareError([20, 'ntime out of range']);
        }
        if (nonce.length !== 64) {
            return shareError([20, 'incorrect size of nonce']);
        }
        if (soln.length !== 2694) {
            return shareError([20, 'incorrect size of solution']);
        }
        if (!job.registerSubmit(extraNonce1, extraNonce2, nTime, nonce)) {
            return shareError([22, 'duplicate share']);
        }

        var headerBuffer = job.serializeHeader(nTime, nonce); // 144 bytes (doesn't contain soln)
        var headerSolnBuffer = new Buffer.concat([headerBuffer, new Buffer(soln, 'hex')]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant