rpc: fix submitwork.
This commit is contained in:
parent
1e9855a4fa
commit
590c4350e9
@ -1029,11 +1029,11 @@ RPC.prototype._submitWork = async function _submitWork(data) {
|
||||
if (data.length !== 128)
|
||||
throw new RPCError(errs.INVALID_PARAMETER, 'Invalid work size.');
|
||||
|
||||
header = Headers.fromHead(data);
|
||||
|
||||
data = data.slice(0, 80);
|
||||
data = swap32(data);
|
||||
|
||||
header = Headers.fromHead(data);
|
||||
|
||||
if (header.prevBlock !== attempt.prevBlock
|
||||
|| header.bits !== attempt.bits) {
|
||||
return false;
|
||||
@ -1047,8 +1047,7 @@ RPC.prototype._submitWork = async function _submitWork(data) {
|
||||
if (!nonces)
|
||||
return false;
|
||||
|
||||
n1 = nonces.nonce1;
|
||||
n2 = nonces.nonce2;
|
||||
[n1, n2] = nonces;
|
||||
nonce = header.nonce;
|
||||
ts = header.ts;
|
||||
|
||||
@ -2332,7 +2331,7 @@ RPC.prototype.updateWork = async function updateWork() {
|
||||
root = attempt.getRoot(n1, n2);
|
||||
root = root.toString('hex');
|
||||
|
||||
this.merkleMap.set(root, new Nonces(n1, n2));
|
||||
this.merkleMap.set(root, [n1, n2]);
|
||||
|
||||
return attempt;
|
||||
}
|
||||
@ -2352,7 +2351,7 @@ RPC.prototype.updateWork = async function updateWork() {
|
||||
|
||||
this.attempt = attempt;
|
||||
this.lastActivity = util.now();
|
||||
this.merkleMap.set(root, new Nonces(n1, n2));
|
||||
this.merkleMap.set(root, [n1, n2]);
|
||||
|
||||
return attempt;
|
||||
};
|
||||
@ -2737,11 +2736,6 @@ function toDeployment(id, version, status) {
|
||||
};
|
||||
}
|
||||
|
||||
function Nonces(n1, n2) {
|
||||
this.nonce1 = n1;
|
||||
this.nonce2 = n2;
|
||||
}
|
||||
|
||||
function parseAddress(raw, network) {
|
||||
try {
|
||||
return Address.fromString(raw, network);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user