Przeglądaj źródła

some changes

master
mortie 6 lat temu
rodzic
commit
c776df39c7

+ 1
- 0
js/miner-cpu/index.js Wyświetl plik

@@ -111,6 +111,7 @@ class CPUMiner {
}

async startWork(work) {
console.log("Starting work", work.id);
if (this.exnounce1 == null) {
console.log("Ignoring work because extranounce is null.");
return false;

+ 1
- 1
js/miner-cpu/mining-process.js Wyświetl plik

@@ -12,7 +12,7 @@ coinb2 = Buffer.from(coinb2, "hex");
exnounce1 = Buffer.from(exnounce1, "hex");
exnounce2 = Buffer.from(exnounce2, "hex");

difficulty = 3;
difficulty = 5;

var hashes = 0;
var sd = new Date().getTime();

+ 14
- 5
js/rpcconn.js Wyświetl plik

@@ -17,7 +17,13 @@ class RPCConn {
});

var onjson = json => {
var obj = JSON.parse(json);
var obj;
try {
obj = JSON.parse(json);
} catch (err) {
console.log("Failed to parse JSON: '"+json+"'");
throw err;
}

if (obj.id == null) {
var listeners = this._listeners[obj.method];
@@ -37,14 +43,17 @@ class RPCConn {
cb(obj.error, obj.result);
}

//Digest JSON lines as they come, but only if they're a whole line
var currdata = "";
this.sock.on("data", d => {
var s = d.toString();
currdata += d;
if (s.indexOf("\n") !== -1) {
currdata.split("\n").filter(l => l !== "").forEach(onjson);
currdata = "";
currdata += s;
var arr = s.split("\n");
while (arr[1] != null) {
onjson(arr.shift());
arr.shift();
}
currdata = arr[0] || "";
});
}


+ 3
- 2
js/stratum-client.js Wyświetl plik

@@ -15,7 +15,7 @@ class StratumClient {
}

async startWork() {
this.log("Starting work");
this.log("Starting work", this.work.id);
var res;
try {
res = await this.miner.startWork(this.work);
@@ -51,6 +51,7 @@ class StratumClient {
});

var sub = await this.rpc.call("mining.subscribe");
this.log("Got nounce", sub[1]);
this.miner.setNounce(sub[1], sub[2]);
if (--this.waitFor == 0)
this.startWork();
@@ -61,7 +62,7 @@ class StratumClient {
if (!success)
throw new Error("Incorrect username/password.");

console.log("Authenticated "+user+".");
this.log("Authenticated "+user+".");
}

writePayload() {

+ 0
- 1
package-lock.json Wyświetl plik

@@ -2,7 +2,6 @@
"name": "stratum-test",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bindings": {
"version": "1.3.0",

Ładowanie…
Anuluj
Zapisz