forked from circlecloud/tera
feat: alpine 0.0.1 version complate
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
63536569cf
commit
13607ba157
@ -18,10 +18,13 @@
|
|||||||
"clean": "npx rimraf dist",
|
"clean": "npx rimraf dist",
|
||||||
"prebuild": "yarn clean",
|
"prebuild": "yarn clean",
|
||||||
"watch": "npx tsc --watch",
|
"watch": "npx tsc --watch",
|
||||||
|
"postbuild": "cp src/HTML/* dist/HTML/ -rf",
|
||||||
"build": "npx tsc",
|
"build": "npx tsc",
|
||||||
"start": "node dist/run-node.js"
|
"start": "node dist/run-node.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/bintrees": "^1.0.2",
|
||||||
|
"@types/secp256k1": "^3.5.0",
|
||||||
"bintrees": "^1.0.2",
|
"bintrees": "^1.0.2",
|
||||||
"greenlock": "^2.6.7",
|
"greenlock": "^2.6.7",
|
||||||
"ntp-client": "^0.5.3",
|
"ntp-client": "^0.5.3",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
282
src/HTML/JS/sign-lib-min.js
vendored
282
src/HTML/JS/sign-lib-min.js
vendored
@ -31,7 +31,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}(), $jscomp.initSymbolIterator = function() {
|
}(), $jscomp.initSymbolIterator = function() {
|
||||||
$jscomp.initSymbol();
|
$jscomp.initSymbol();
|
||||||
var t = $jscomp.global.Symbol.iterator;
|
var t = $jscomp.global.Symbol.iterator;
|
||||||
t || (t = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")), "function" != typeof Array.prototype[t] && $jscomp.defineProperty(Array.prototype,
|
t = t || ($jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")), "function" != typeof Array.prototype[t] && $jscomp.defineProperty(Array.prototype,
|
||||||
t, {
|
t, {
|
||||||
configurable: !0, writable: !0, value: function() {
|
configurable: !0, writable: !0, value: function() {
|
||||||
return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this));
|
return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this));
|
||||||
@ -41,7 +41,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, $jscomp.initSymbolAsyncIterator = function() {
|
}, $jscomp.initSymbolAsyncIterator = function() {
|
||||||
$jscomp.initSymbol();
|
$jscomp.initSymbol();
|
||||||
var t = $jscomp.global.Symbol.asyncIterator;
|
var t = $jscomp.global.Symbol.asyncIterator;
|
||||||
t || (t = $jscomp.global.Symbol.asyncIterator = $jscomp.global.Symbol("asyncIterator")), $jscomp.initSymbolAsyncIterator = function() {
|
t = t || ($jscomp.global.Symbol.asyncIterator = $jscomp.global.Symbol("asyncIterator")), $jscomp.initSymbolAsyncIterator = function() {
|
||||||
};
|
};
|
||||||
}, $jscomp.iteratorPrototype = function(t) {
|
}, $jscomp.iteratorPrototype = function(t) {
|
||||||
return $jscomp.initSymbolIterator(), (t = { next: t })[$jscomp.global.Symbol.iterator] = function() {
|
return $jscomp.initSymbolIterator(), (t = { next: t })[$jscomp.global.Symbol.iterator] = function() {
|
||||||
@ -97,7 +97,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, r.fromByteArray = function(t) {
|
}, r.fromByteArray = function(t) {
|
||||||
for (var e = t.length, r = e % 3, i = [], n = 0, s = e - r; n < s; n += 16383)
|
for (var e = t.length, r = e % 3, i = [], n = 0, s = e - r; n < s; n += 16383)
|
||||||
i.push(o(t, n, s < n + 16383 ? s : n + 16383));
|
i.push(o(t, n, s < n + 16383 ? s : n + 16383));
|
||||||
return 1 === r ? (t = t[e - 1], i.push(h[t >> 2] + h[t << 4 & 63] + "==")) : 2 === r && (t = (t[e - 2] << 8) + t[e - 1], i.push(h[t >> 10] + h[t >> 4 & 63] + h[t << 2 & 63] + "=")),
|
return 1 == r ? (t = t[e - 1], i.push(h[t >> 2] + h[t << 4 & 63] + "==")) : 2 == r && (t = (t[e - 2] << 8) + t[e - 1], i.push(h[t >> 10] + h[t >> 4 & 63] + h[t << 2 & 63] + "=")),
|
||||||
i.join("");
|
i.join("");
|
||||||
};
|
};
|
||||||
var h = [], u = [], l = "undefined" != typeof Uint8Array ? Uint8Array : Array;
|
var h = [], u = [], l = "undefined" != typeof Uint8Array ? Uint8Array : Array;
|
||||||
@ -322,7 +322,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
throw new RangeError("Index out of range");
|
throw new RangeError("Index out of range");
|
||||||
};
|
};
|
||||||
|
|
||||||
function g(t, e, r, i, n, s) {
|
function g(t, e, r, i) {
|
||||||
if (r + i > t.length)
|
if (r + i > t.length)
|
||||||
throw new RangeError("Index out of range");
|
throw new RangeError("Index out of range");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -527,7 +527,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
return "";
|
return "";
|
||||||
if ((r >>>= 0) <= (e >>>= 0))
|
if ((r >>>= 0) <= (e >>>= 0))
|
||||||
return "";
|
return "";
|
||||||
for (t || (t = "utf8"); ;)
|
for (t = t || "utf8"; ;)
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case "hex":
|
case "hex":
|
||||||
for (t = e, e = r, r = this.length, (!t || t < 0) && (t = 0), (!e || e < 0 || r < e) && (e = r), i = "", r = t; r < e; ++r)
|
for (t = e, e = r, r = this.length, (!t || t < 0) && (t = 0), (!e || e < 0 || r < e) && (e = r), i = "", r = t; r < e; ++r)
|
||||||
@ -608,7 +608,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
var n = this.length - e;
|
var n = this.length - e;
|
||||||
if ((void 0 === r || n < r) && (r = n), 0 < t.length && (r < 0 || e < 0) || e > this.length)
|
if ((void 0 === r || n < r) && (r = n), 0 < t.length && (r < 0 || e < 0) || e > this.length)
|
||||||
throw new RangeError("Attempt to write outside buffer bounds");
|
throw new RangeError("Attempt to write outside buffer bounds");
|
||||||
for (i || (i = "utf8"), n = !1; ;)
|
for (i = i || "utf8", n = !1; ;)
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case "hex":
|
case "hex":
|
||||||
t:
|
t:
|
||||||
@ -768,8 +768,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, h.prototype.copy = function(t, e, r, i) {
|
}, h.prototype.copy = function(t, e, r, i) {
|
||||||
if (!h.isBuffer(t))
|
if (!h.isBuffer(t))
|
||||||
throw new TypeError("argument should be a Buffer");
|
throw new TypeError("argument should be a Buffer");
|
||||||
if (r || (r = 0), i || 0 === i || (i = this.length), e >= t.length && (e = t.length), e || (e = 0), 0 < i && i < r && (i = r),
|
if (r = r || 0, i || 0 === i || (i = this.length), e >= t.length && (e = t.length), e = e || 0, 0 < i && i < r && (i = r), i === r || 0 === t.length || 0 === this.length)
|
||||||
i === r || 0 === t.length || 0 === this.length)
|
|
||||||
return 0;
|
return 0;
|
||||||
if (e < 0)
|
if (e < 0)
|
||||||
throw new RangeError("targetStart out of bounds");
|
throw new RangeError("targetStart out of bounds");
|
||||||
@ -805,7 +804,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
throw new RangeError("Out of range index");
|
throw new RangeError("Out of range index");
|
||||||
if (r <= e)
|
if (r <= e)
|
||||||
return this;
|
return this;
|
||||||
if (e >>>= 0, r = void 0 === r ? this.length : r >>> 0, t || (t = 0), "number" == typeof t)
|
if (e >>>= 0, r = void 0 === r ? this.length : r >>> 0, "number" == typeof (t = t || 0))
|
||||||
for (i = e; i < r; ++i)
|
for (i = e; i < r; ++i)
|
||||||
this[i] = t;
|
this[i] = t;
|
||||||
else {
|
else {
|
||||||
@ -926,7 +925,8 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
var l = Object.create || function(t) {
|
var l = Object.create || function(t) {
|
||||||
var e = function() {
|
|
||||||
|
function e() {
|
||||||
};
|
};
|
||||||
return e.prototype = t, new e;
|
return e.prototype = t, new e;
|
||||||
}, f = Object.keys || function(t) {
|
}, f = Object.keys || function(t) {
|
||||||
@ -1126,7 +1126,8 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
t.super_ = e, t.prototype = Object.create(e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } });
|
t.super_ = e, t.prototype = Object.create(e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } });
|
||||||
} : function(t, e) {
|
} : function(t, e) {
|
||||||
t.super_ = e;
|
t.super_ = e;
|
||||||
var r = function() {
|
|
||||||
|
function r() {
|
||||||
};
|
};
|
||||||
r.prototype = e.prototype, t.prototype = new r, t.prototype.constructor = t;
|
r.prototype = e.prototype, t.prototype = new r, t.prototype.constructor = t;
|
||||||
};
|
};
|
||||||
@ -1333,22 +1334,22 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
r(null, t);
|
r(null, t);
|
||||||
};
|
};
|
||||||
}, { "./_stream_transform": 16, "core-util-is": 4, inherits: 7 }], 15: [function(L, k, t) {
|
}, { "./_stream_transform": 16, "core-util-is": 4, inherits: 7 }], 15: [function(L, k, t) {
|
||||||
(function(m, t) {
|
(function(p, t) {
|
||||||
|
|
||||||
function e(t, e) {
|
function e(t, e) {
|
||||||
t = t || {};
|
t = t || {};
|
||||||
var r = e instanceof (p = p || L("./_stream_duplex"));
|
var r = e instanceof (b = b || L("./_stream_duplex"));
|
||||||
this.objectMode = !!t.objectMode, r && (this.objectMode = this.objectMode || !!t.readableObjectMode);
|
this.objectMode = !!t.objectMode, r && (this.objectMode = this.objectMode || !!t.readableObjectMode);
|
||||||
var i = t.highWaterMark, n = t.readableHighWaterMark, s = this.objectMode ? 16 : 16384;
|
var i = t.highWaterMark, n = t.readableHighWaterMark, s = this.objectMode ? 16 : 16384;
|
||||||
this.highWaterMark = i || 0 === i ? i : r && (n || 0 === n) ? n : s, this.highWaterMark = Math.floor(this.highWaterMark), this.buffer = new B,
|
this.highWaterMark = i || 0 === i ? i : r && (n || 0 === n) ? n : s, this.highWaterMark = Math.floor(this.highWaterMark), this.buffer = new B,
|
||||||
this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.reading = this.endEmitted = this.ended = !1,
|
this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.reading = this.endEmitted = this.ended = !1,
|
||||||
this.sync = !0, this.destroyed = this.resumeScheduled = this.readableListening = this.emittedReadable = this.needReadable = !1,
|
this.sync = !0, this.destroyed = this.resumeScheduled = this.readableListening = this.emittedReadable = this.needReadable = !1,
|
||||||
this.defaultEncoding = t.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.encoding = this.decoder = null,
|
this.defaultEncoding = t.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.encoding = this.decoder = null,
|
||||||
t.encoding && (A || (A = L("string_decoder/").StringDecoder), this.decoder = new A(t.encoding), this.encoding = t.encoding);
|
t.encoding && (A = A || L("string_decoder/").StringDecoder, this.decoder = new A(t.encoding), this.encoding = t.encoding);
|
||||||
};
|
};
|
||||||
|
|
||||||
function r(t) {
|
function r(t) {
|
||||||
if (p = p || L("./_stream_duplex"), !(this instanceof r))
|
if (b = b || L("./_stream_duplex"), !(this instanceof r))
|
||||||
return new r(t);
|
return new r(t);
|
||||||
this._readableState = new e(t, this), this.readable = !0, t && ("function" == typeof t.read && (this._read = t.read), "function" == typeof t.destroy && (this._destroy = t.destroy)),
|
this._readableState = new e(t, this), this.readable = !0, t && ("function" == typeof t.read && (this._read = t.read), "function" == typeof t.destroy && (this._destroy = t.destroy)),
|
||||||
w.call(this);
|
w.call(this);
|
||||||
@ -1368,14 +1369,14 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
a ? t.emit("error", a) : s.objectMode || e && 0 < e.length ? ("string" == typeof e || s.objectMode || Object.getPrototypeOf(e) === v.prototype || (e = v.from(e)),
|
a ? t.emit("error", a) : s.objectMode || e && 0 < e.length ? ("string" == typeof e || s.objectMode || Object.getPrototypeOf(e) === v.prototype || (e = v.from(e)),
|
||||||
i ? s.endEmitted ? t.emit("error", Error("stream.unshift() after end event")) : h(t, s, e, !0) : s.ended ? t.emit("error",
|
i ? s.endEmitted ? t.emit("error", Error("stream.unshift() after end event")) : h(t, s, e, !0) : s.ended ? t.emit("error",
|
||||||
Error("stream.push() after EOF")) : (s.reading = !1, s.decoder && !r ? (e = s.decoder.write(e), s.objectMode || 0 !== e.length ? h(t,
|
Error("stream.push() after EOF")) : (s.reading = !1, s.decoder && !r ? (e = s.decoder.write(e), s.objectMode || 0 !== e.length ? h(t,
|
||||||
s, e, !1) : s.readingMore || (s.readingMore = !0, b.nextTick(l, t, s))) : h(t, s, e, !1))) : i || (s.reading = !1);
|
s, e, !1) : s.readingMore || (s.readingMore = !0, g.nextTick(l, t, s))) : h(t, s, e, !1))) : i || (s.reading = !1);
|
||||||
}
|
}
|
||||||
return !s.ended && (s.needReadable || s.length < s.highWaterMark || 0 === s.length);
|
return !s.ended && (s.needReadable || s.length < s.highWaterMark || 0 === s.length);
|
||||||
};
|
};
|
||||||
|
|
||||||
function h(t, e, r, i) {
|
function h(t, e, r, i) {
|
||||||
e.flowing && 0 === e.length && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r),
|
e.flowing && 0 === e.length && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r),
|
||||||
e.needReadable && u(t)), e.readingMore || (e.readingMore = !0, b.nextTick(l, t, e));
|
e.needReadable && u(t)), e.readingMore || (e.readingMore = !0, g.nextTick(l, t, e));
|
||||||
};
|
};
|
||||||
|
|
||||||
function s(t, e) {
|
function s(t, e) {
|
||||||
@ -1394,11 +1395,11 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
|
|
||||||
function u(t) {
|
function u(t) {
|
||||||
var e = t._readableState;
|
var e = t._readableState;
|
||||||
e.needReadable = !1, e.emittedReadable || (I("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? b.nextTick(i, t) : i(t));
|
e.needReadable = !1, e.emittedReadable || (I("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? g.nextTick(i, t) : i(t));
|
||||||
};
|
};
|
||||||
|
|
||||||
function i(t) {
|
function i(t) {
|
||||||
I("emit readable"), t.emit("readable"), _(t);
|
I("emit readable"), t.emit("readable"), m(t);
|
||||||
};
|
};
|
||||||
|
|
||||||
function l(t, e) {
|
function l(t, e) {
|
||||||
@ -1413,10 +1414,10 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function a(t, e) {
|
function a(t, e) {
|
||||||
e.reading || (I("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), _(t), e.flowing && !e.reading && t.read(0);
|
e.reading || (I("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), m(t), e.flowing && !e.reading && t.read(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
function _(t) {
|
function m(t) {
|
||||||
var e = t._readableState;
|
var e = t._readableState;
|
||||||
for (I("flow", e.flowing); e.flowing && null !== t.read(););
|
for (I("flow", e.flowing); e.flowing && null !== t.read(););
|
||||||
};
|
};
|
||||||
@ -1471,22 +1472,22 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
var e = t._readableState;
|
var e = t._readableState;
|
||||||
if (0 < e.length)
|
if (0 < e.length)
|
||||||
throw Error('"endReadable()" called on non-empty stream');
|
throw Error('"endReadable()" called on non-empty stream');
|
||||||
e.endEmitted || (e.ended = !0, b.nextTick(d, e, t));
|
e.endEmitted || (e.ended = !0, g.nextTick(d, e, t));
|
||||||
};
|
};
|
||||||
|
|
||||||
function d(t, e) {
|
function d(t, e) {
|
||||||
t.endEmitted || 0 !== t.length || (t.endEmitted = !0, e.readable = !1, e.emit("end"));
|
t.endEmitted || 0 !== t.length || (t.endEmitted = !0, e.readable = !1, e.emit("end"));
|
||||||
};
|
};
|
||||||
|
|
||||||
function g(t, e) {
|
function _(t, e) {
|
||||||
for (var r = 0, i = t.length; r < i; r++)
|
for (var r = 0, i = t.length; r < i; r++)
|
||||||
if (t[r] === e)
|
if (t[r] === e)
|
||||||
return r;
|
return r;
|
||||||
return - 1;
|
return - 1;
|
||||||
};
|
};
|
||||||
var b = L("process-nextick-args");
|
var g = L("process-nextick-args");
|
||||||
k.exports = r;
|
k.exports = r;
|
||||||
var p, y = L("isarray");
|
var b, y = L("isarray");
|
||||||
r.ReadableState = e, L("events");
|
r.ReadableState = e, L("events");
|
||||||
var w = L("./internal/streams/stream"), v = L("safe-buffer").Buffer, M = t.Uint8Array || function() {
|
var w = L("./internal/streams/stream"), v = L("safe-buffer").Buffer, M = t.Uint8Array || function() {
|
||||||
}, E = L("core-util-is");
|
}, E = L("core-util-is");
|
||||||
@ -1517,7 +1518,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, r.prototype.isPaused = function() {
|
}, r.prototype.isPaused = function() {
|
||||||
return !1 === this._readableState.flowing;
|
return !1 === this._readableState.flowing;
|
||||||
}, r.prototype.setEncoding = function(t) {
|
}, r.prototype.setEncoding = function(t) {
|
||||||
return A || (A = L("string_decoder/").StringDecoder), this._readableState.decoder = new A(t), this._readableState.encoding = t,
|
return A = A || L("string_decoder/").StringDecoder, this._readableState.decoder = new A(t), this._readableState.encoding = t,
|
||||||
this;
|
this;
|
||||||
}, r.prototype.read = function(t) {
|
}, r.prototype.read = function(t) {
|
||||||
I("read", t), t = parseInt(t, 10);
|
I("read", t), t = parseInt(t, 10);
|
||||||
@ -1541,8 +1542,8 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function s(t) {
|
function s(t) {
|
||||||
I("ondata"), (p = !1) !== i.write(t) || p || ((1 === f.pipesCount && f.pipes === i || 1 < f.pipesCount && - 1 !== g(f.pipes,
|
I("ondata"), (r = !1) !== i.write(t) || r || ((1 === f.pipesCount && f.pipes === i || 1 < f.pipesCount && - 1 !== _(f.pipes,
|
||||||
i)) && !d && (I("false write response, pause", l._readableState.awaitDrain), l._readableState.awaitDrain++ , p = !0), l.pause());
|
i)) && !d && (I("false write response, pause", l._readableState.awaitDrain), l._readableState.awaitDrain++ , r = !0), l.pause());
|
||||||
};
|
};
|
||||||
|
|
||||||
function o(t) {
|
function o(t) {
|
||||||
@ -1572,19 +1573,21 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
f.pipes.push(i);
|
f.pipes.push(i);
|
||||||
}
|
}
|
||||||
f.pipesCount += 1, I("pipe count=%d opts=%j", f.pipesCount, t);
|
f.pipesCount += 1, I("pipe count=%d opts=%j", f.pipesCount, t);
|
||||||
var e = t && !1 === t.end || i === m.stdout || i === m.stderr ? u : n;
|
var e = t && !1 === t.end || i === p.stdout || i === p.stderr ? u : n;
|
||||||
f.endEmitted ? b.nextTick(e) : l.once("end", e), i.on("unpipe", function t(e, r) {
|
f.endEmitted ? g.nextTick(e) : l.once("end", e), i.on("unpipe", function t(e, r) {
|
||||||
I("onunpipe"), e === l && r && !1 === r.hasUnpiped && (r.hasUnpiped = !0, I("cleanup"), i.removeListener("close", a), i.removeListener("finish",
|
I("onunpipe"), e === l && r && !1 === r.hasUnpiped && (r.hasUnpiped = !0, I("cleanup"), i.removeListener("close", a), i.removeListener("finish",
|
||||||
h), i.removeListener("drain", c), i.removeListener("error", o), i.removeListener("unpipe", t), l.removeListener("end", n),
|
h), i.removeListener("drain", c), i.removeListener("error", o), i.removeListener("unpipe", t), l.removeListener("end", n),
|
||||||
l.removeListener("end", u), l.removeListener("data", s), d = !0, !f.awaitDrain || i._writableState && !i._writableState.needDrain || c());
|
l.removeListener("end", u), l.removeListener("data", s), d = !0, !f.awaitDrain || i._writableState && !i._writableState.needDrain || c());
|
||||||
});
|
});
|
||||||
var r, c = (r = l, function() {
|
var c = function(e) {
|
||||||
var t = r._readableState;
|
return function() {
|
||||||
I("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain-- , 0 === t.awaitDrain && r.listeners("data").length && (t.flowing = !0,
|
var t = e._readableState;
|
||||||
_(r));
|
I("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain-- , 0 === t.awaitDrain && e.listeners("data").length && (t.flowing = !0,
|
||||||
});
|
m(e));
|
||||||
|
};
|
||||||
|
}(l);
|
||||||
i.on("drain", c);
|
i.on("drain", c);
|
||||||
var d = !1, p = !1;
|
var d = !1, r = !1;
|
||||||
return l.on("data", s), function(t, e, r) {
|
return l.on("data", s), function(t, e, r) {
|
||||||
if ("function" == typeof t.prependListener)
|
if ("function" == typeof t.prependListener)
|
||||||
return t.prependListener(e, r);
|
return t.prependListener(e, r);
|
||||||
@ -1596,10 +1599,10 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
if (0 === e.pipesCount)
|
if (0 === e.pipesCount)
|
||||||
return this;
|
return this;
|
||||||
if (1 === e.pipesCount)
|
if (1 === e.pipesCount)
|
||||||
return t && t !== e.pipes || (t || (t = e.pipes), e.pipes = null, e.pipesCount = 0, e.flowing = !1, t && t.emit("unpipe", this,
|
return t && t !== e.pipes || (t = t || e.pipes, e.pipes = null, e.pipesCount = 0, e.flowing = !1, t && t.emit("unpipe", this,
|
||||||
r)), this;
|
r)), this;
|
||||||
if (t)
|
if (t)
|
||||||
return - 1 === (i = g(e.pipes, t)) || (e.pipes.splice(i, 1), --e.pipesCount, 1 === e.pipesCount && (e.pipes = e.pipes[0]),
|
return - 1 === (i = _(e.pipes, t)) || (e.pipes.splice(i, 1), --e.pipesCount, 1 === e.pipesCount && (e.pipes = e.pipes[0]),
|
||||||
t.emit("unpipe", this, r)), this;
|
t.emit("unpipe", this, r)), this;
|
||||||
t = e.pipes;
|
t = e.pipes;
|
||||||
var i = e.pipesCount;
|
var i = e.pipesCount;
|
||||||
@ -1613,13 +1616,13 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
else
|
else
|
||||||
if ("readable" === t) {
|
if ("readable" === t) {
|
||||||
var i = this._readableState;
|
var i = this._readableState;
|
||||||
i.endEmitted || i.readableListening || (i.readableListening = i.needReadable = !0, i.emittedReadable = !1, i.reading ? i.length && u(this) : b.nextTick(o,
|
i.endEmitted || i.readableListening || (i.readableListening = i.needReadable = !0, i.emittedReadable = !1, i.reading ? i.length && u(this) : g.nextTick(o,
|
||||||
this));
|
this));
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}, r.prototype.resume = function() {
|
}, r.prototype.resume = function() {
|
||||||
var t = this._readableState;
|
var t = this._readableState;
|
||||||
return t.flowing || (I("resume"), t.flowing = !0, t.resumeScheduled || (t.resumeScheduled = !0, b.nextTick(a, this, t))), this;
|
return t.flowing || (I("resume"), t.flowing = !0, t.resumeScheduled || (t.resumeScheduled = !0, g.nextTick(a, this, t))), this;
|
||||||
}, r.prototype.pause = function() {
|
}, r.prototype.pause = function() {
|
||||||
return I("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (I("pause"), this._readableState.flowing = !1,
|
return I("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (I("pause"), this._readableState.flowing = !1,
|
||||||
this.emit("pause")), this;
|
this.emit("pause")), this;
|
||||||
@ -1830,7 +1833,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, n.prototype.write = function(t, e, r) {
|
}, n.prototype.write = function(t, e, r) {
|
||||||
var i, n = this._writableState, s = !1;
|
var i, n = this._writableState, s = !1;
|
||||||
if ((i = !n.objectMode) && (i = t, i = b.isBuffer(i) || i instanceof y), i && !b.isBuffer(t) && (t = b.from(t)), "function" == typeof e && (r = e,
|
if ((i = !n.objectMode) && (i = t, i = b.isBuffer(i) || i instanceof y), i && !b.isBuffer(t) && (t = b.from(t)), "function" == typeof e && (r = e,
|
||||||
e = null), i ? e = "buffer" : e || (e = n.defaultEncoding), "function" != typeof r && (r = l), n.ended)
|
e = null), e = i ? "buffer" : e || n.defaultEncoding, "function" != typeof r && (r = l), n.ended)
|
||||||
n = r, r = Error("write after end"), this.emit("error", r), d.nextTick(n, r);
|
n = r, r = Error("write after end"), this.emit("error", r), d.nextTick(n, r);
|
||||||
else {
|
else {
|
||||||
var o;
|
var o;
|
||||||
@ -1882,31 +1885,30 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
inherits: 7, "process-nextick-args": 10, "safe-buffer": 25, timers: 28, "util-deprecate": 29
|
inherits: 7, "process-nextick-args": 10, "safe-buffer": 25, timers: 28, "util-deprecate": 29
|
||||||
}], 18: [function(t, e, r) {
|
}], 18: [function(t, e, r) {
|
||||||
var i = t("safe-buffer").Buffer, n = t("util");
|
var i = t("safe-buffer").Buffer, n = t("util");
|
||||||
e.exports = function() {
|
|
||||||
|
|
||||||
function t() {
|
function s() {
|
||||||
if (!(this instanceof t))
|
if (!(this instanceof s))
|
||||||
throw new TypeError("Cannot call a class as a function");
|
throw new TypeError("Cannot call a class as a function");
|
||||||
this.tail = this.head = null, this.length = 0;
|
this.tail = this.head = null, this.length = 0;
|
||||||
};
|
};
|
||||||
return t.prototype.push = function(t) {
|
e.exports = (s.prototype.push = function(t) {
|
||||||
t = { data: t, next: null }, 0 < this.length ? this.tail.next = t : this.head = t, this.tail = t, ++this.length;
|
t = { data: t, next: null }, 0 < this.length ? this.tail.next = t : this.head = t, this.tail = t, ++this.length;
|
||||||
}, t.prototype.unshift = function(t) {
|
}, s.prototype.unshift = function(t) {
|
||||||
t = { data: t, next: this.head }, 0 === this.length && (this.tail = t), this.head = t, ++this.length;
|
t = { data: t, next: this.head }, 0 === this.length && (this.tail = t), this.head = t, ++this.length;
|
||||||
}, t.prototype.shift = function() {
|
}, s.prototype.shift = function() {
|
||||||
if (0 !== this.length) {
|
if (0 !== this.length) {
|
||||||
var t = this.head.data;
|
var t = this.head.data;
|
||||||
return this.head = 1 === this.length ? this.tail = null : this.head.next, --this.length, t;
|
return this.head = 1 === this.length ? this.tail = null : this.head.next, --this.length, t;
|
||||||
}
|
}
|
||||||
}, t.prototype.clear = function() {
|
}, s.prototype.clear = function() {
|
||||||
this.head = this.tail = null, this.length = 0;
|
this.head = this.tail = null, this.length = 0;
|
||||||
}, t.prototype.join = function(t) {
|
}, s.prototype.join = function(t) {
|
||||||
if (0 === this.length)
|
if (0 === this.length)
|
||||||
return "";
|
return "";
|
||||||
for (var e = this.head, r = "" + e.data; e = e.next;)
|
for (var e = this.head, r = "" + e.data; e = e.next;)
|
||||||
r += t + e.data;
|
r += t + e.data;
|
||||||
return r;
|
return r;
|
||||||
}, t.prototype.concat = function(t) {
|
}, s.prototype.concat = function(t) {
|
||||||
if (0 === this.length)
|
if (0 === this.length)
|
||||||
return i.alloc(0);
|
return i.alloc(0);
|
||||||
if (1 === this.length)
|
if (1 === this.length)
|
||||||
@ -1915,8 +1917,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
for (var e = this.head, r = 0; e;)
|
for (var e = this.head, r = 0; e;)
|
||||||
e.data.copy(t, r), r += e.data.length, e = e.next;
|
e.data.copy(t, r), r += e.data.length, e = e.next;
|
||||||
return t;
|
return t;
|
||||||
}, t;
|
}, s), n && n.inspect && n.inspect.custom && (e.exports.prototype[n.inspect.custom] = function() {
|
||||||
}(), n && n.inspect && n.inspect.custom && (e.exports.prototype[n.inspect.custom] = function() {
|
|
||||||
var t = n.inspect({ length: this.length });
|
var t = n.inspect({ length: this.length });
|
||||||
return this.constructor.name + " " + t;
|
return this.constructor.name + " " + t;
|
||||||
});
|
});
|
||||||
@ -2119,7 +2120,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
|
|
||||||
function h(t, e) {
|
function h(t, e) {
|
||||||
var r = (t.length - e) % 3;
|
var r = (t.length - e) % 3;
|
||||||
return 0 === r ? t.toString("base64", e) : (this.lastNeed = 3 - r, this.lastTotal = 3, 1 === r ? this.lastChar[0] = t[t.length - 1] : (this.lastChar[0] = t[t.length - 2],
|
return 0 == r ? t.toString("base64", e) : (this.lastNeed = 3 - r, this.lastTotal = 3, 1 == r ? this.lastChar[0] = t[t.length - 1] : (this.lastChar[0] = t[t.length - 2],
|
||||||
this.lastChar[1] = t[t.length - 1]), t.toString("base64", e, t.length - r));
|
this.lastChar[1] = t[t.length - 1]), t.toString("base64", e, t.length - r));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2683,7 +2684,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
return r.words = [0], r.length = 1, r;
|
return r.words = [0], r.length = 1, r;
|
||||||
for (var i = 0, n = 0; i < t.length; ++i)
|
for (var i = 0, n = 0; i < t.length; ++i)
|
||||||
n = t.words[i] * e + n, r.words[i] = 67108863 & n, n = n / 67108864 | 0;
|
n = t.words[i] * e + n, r.words[i] = 67108863 & n, n = n / 67108864 | 0;
|
||||||
return r.length = 0 < n ? (r.words[i] = n, t.length + 1) : t.length, r;
|
return 0 < n ? (r.words[i] = n, r.length = t.length + 1) : r.length = t.length, r;
|
||||||
}, l.prototype.umul = function(t) {
|
}, l.prototype.umul = function(t) {
|
||||||
var e = new l;
|
var e = new l;
|
||||||
return e.words = Array(this.length + t.length), 10 === this.length && 10 === t.length ? l.umulTo10x10(this, t, e) : 1 === this.length ? l.umulnTo(t,
|
return e.words = Array(this.length + t.length), 10 === this.length && 10 === t.length ? l.umulTo10x10(this, t, e) : 1 === this.length ? l.umulnTo(t,
|
||||||
@ -2841,95 +2842,95 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
N = 8191 & U;
|
N = 8191 & U;
|
||||||
var D = U >>> 13, q = 0 | n[8];
|
var D = U >>> 13, q = 0 | n[8];
|
||||||
U = 8191 & q;
|
U = 8191 & q;
|
||||||
var K = q >>> 13, V = 8191 & (n = 0 | n[9]), Y = n >>> 13;
|
var K = q >>> 13, V = 8191 & (n = 0 | n[9]), z = n >>> 13;
|
||||||
r.length = 19;
|
r.length = 19;
|
||||||
var z = Math.imul(o, I);
|
var Y = Math.imul(o, I);
|
||||||
n = Math.imul(o, A);
|
n = Math.imul(o, A);
|
||||||
var $ = t + z + ((8191 & (n += Math.imul(a, I))) << 13);
|
var $ = t + Y + ((8191 & (n += Math.imul(a, I))) << 13);
|
||||||
t = (q = Math.imul(a, A)) + (n >>> 13) + ($ >>> 26), $ &= 67108863, z = Math.imul(s, I), n = Math.imul(s, A), n += Math.imul(u,
|
t = (q = Math.imul(a, A)) + (n >>> 13) + ($ >>> 26), $ &= 67108863, Y = Math.imul(s, I), n = Math.imul(s, A), n += Math.imul(u,
|
||||||
I), q = Math.imul(u, A), z += Math.imul(o, S), n += Math.imul(o, x);
|
I), q = Math.imul(u, A), Y += Math.imul(o, S), n += Math.imul(o, x);
|
||||||
var W = t + z + ((8191 & (n += Math.imul(a, S))) << 13);
|
var W = t + Y + ((8191 & (n += Math.imul(a, S))) << 13);
|
||||||
t = (q += Math.imul(a, x)) + (n >>> 13) + (W >>> 26), W &= 67108863, z = Math.imul(h, I), n = Math.imul(h, A), n += Math.imul(f,
|
t = (q += Math.imul(a, x)) + (n >>> 13) + (W >>> 26), W &= 67108863, Y = Math.imul(h, I), n = Math.imul(h, A), n += Math.imul(f,
|
||||||
I), q = Math.imul(f, A), z += Math.imul(s, S), n += Math.imul(s, x), n += Math.imul(u, S), q += Math.imul(u, x), z += Math.imul(o,
|
I), q = Math.imul(f, A), Y += Math.imul(s, S), n += Math.imul(s, x), n += Math.imul(u, S), q += Math.imul(u, x), Y += Math.imul(o,
|
||||||
B), n += Math.imul(o, k);
|
B), n += Math.imul(o, k);
|
||||||
var Z = t + z + ((8191 & (n += Math.imul(a, B))) << 13);
|
var Z = t + Y + ((8191 & (n += Math.imul(a, B))) << 13);
|
||||||
t = (q += Math.imul(a, k)) + (n >>> 13) + (Z >>> 26), Z &= 67108863, z = Math.imul(l, I), n = Math.imul(l, A), n += Math.imul(d,
|
t = (q += Math.imul(a, k)) + (n >>> 13) + (Z >>> 26), Z &= 67108863, Y = Math.imul(l, I), n = Math.imul(l, A), n += Math.imul(d,
|
||||||
I), q = Math.imul(d, A), z += Math.imul(h, S), n += Math.imul(h, x), n += Math.imul(f, S), q += Math.imul(f, x), z += Math.imul(s,
|
I), q = Math.imul(d, A), Y += Math.imul(h, S), n += Math.imul(h, x), n += Math.imul(f, S), q += Math.imul(f, x), Y += Math.imul(s,
|
||||||
B), n += Math.imul(s, k), n += Math.imul(u, B), q += Math.imul(u, k), z += Math.imul(o, L), n += Math.imul(o, C);
|
B), n += Math.imul(s, k), n += Math.imul(u, B), q += Math.imul(u, k), Y += Math.imul(o, L), n += Math.imul(o, C);
|
||||||
var G = t + z + ((8191 & (n += Math.imul(a, L))) << 13);
|
var G = t + Y + ((8191 & (n += Math.imul(a, L))) << 13);
|
||||||
t = (q += Math.imul(a, C)) + (n >>> 13) + (G >>> 26), G &= 67108863, z = Math.imul(c, I), n = Math.imul(c, A), n += Math.imul(m,
|
t = (q += Math.imul(a, C)) + (n >>> 13) + (G >>> 26), G &= 67108863, Y = Math.imul(c, I), n = Math.imul(c, A), n += Math.imul(m,
|
||||||
I), q = Math.imul(m, A), z += Math.imul(l, S), n += Math.imul(l, x), n += Math.imul(d, S), q += Math.imul(d, x), z += Math.imul(h,
|
I), q = Math.imul(m, A), Y += Math.imul(l, S), n += Math.imul(l, x), n += Math.imul(d, S), q += Math.imul(d, x), Y += Math.imul(h,
|
||||||
B), n += Math.imul(h, k), n += Math.imul(f, B), q += Math.imul(f, k), z += Math.imul(s, L), n += Math.imul(s, C), n += Math.imul(u,
|
B), n += Math.imul(h, k), n += Math.imul(f, B), q += Math.imul(f, k), Y += Math.imul(s, L), n += Math.imul(s, C), n += Math.imul(u,
|
||||||
L), q += Math.imul(u, C), z += Math.imul(o, T), n += Math.imul(o, j);
|
L), q += Math.imul(u, C), Y += Math.imul(o, T), n += Math.imul(o, j);
|
||||||
var H = t + z + ((8191 & (n += Math.imul(a, T))) << 13);
|
var H = t + Y + ((8191 & (n += Math.imul(a, T))) << 13);
|
||||||
t = (q += Math.imul(a, j)) + (n >>> 13) + (H >>> 26), H &= 67108863, z = Math.imul(p, I), n = Math.imul(p, A), n += Math.imul(g,
|
t = (q += Math.imul(a, j)) + (n >>> 13) + (H >>> 26), H &= 67108863, Y = Math.imul(p, I), n = Math.imul(p, A), n += Math.imul(g,
|
||||||
I), q = Math.imul(g, A), z += Math.imul(c, S), n += Math.imul(c, x), n += Math.imul(m, S), q += Math.imul(m, x), z += Math.imul(l,
|
I), q = Math.imul(g, A), Y += Math.imul(c, S), n += Math.imul(c, x), n += Math.imul(m, S), q += Math.imul(m, x), Y += Math.imul(l,
|
||||||
B), n += Math.imul(l, k), n += Math.imul(d, B), q += Math.imul(d, k), z += Math.imul(h, L), n += Math.imul(h, C), n += Math.imul(f,
|
B), n += Math.imul(l, k), n += Math.imul(d, B), q += Math.imul(d, k), Y += Math.imul(h, L), n += Math.imul(h, C), n += Math.imul(f,
|
||||||
L), q += Math.imul(f, C), z += Math.imul(s, T), n += Math.imul(s, j), n += Math.imul(u, T), q += Math.imul(u, j), z += Math.imul(o,
|
L), q += Math.imul(f, C), Y += Math.imul(s, T), n += Math.imul(s, j), n += Math.imul(u, T), q += Math.imul(u, j), Y += Math.imul(o,
|
||||||
F), n += Math.imul(o, R);
|
F), n += Math.imul(o, R);
|
||||||
var J = t + z + ((8191 & (n += Math.imul(a, F))) << 13);
|
var J = t + Y + ((8191 & (n += Math.imul(a, F))) << 13);
|
||||||
t = (q += Math.imul(a, R)) + (n >>> 13) + (J >>> 26), J &= 67108863, z = Math.imul(_, I), n = Math.imul(_, A), n += Math.imul(y,
|
t = (q += Math.imul(a, R)) + (n >>> 13) + (J >>> 26), J &= 67108863, Y = Math.imul(_, I), n = Math.imul(_, A), n += Math.imul(y,
|
||||||
I), q = Math.imul(y, A), z += Math.imul(p, S), n += Math.imul(p, x), n += Math.imul(g, S), q += Math.imul(g, x), z += Math.imul(c,
|
I), q = Math.imul(y, A), Y += Math.imul(p, S), n += Math.imul(p, x), n += Math.imul(g, S), q += Math.imul(g, x), Y += Math.imul(c,
|
||||||
B), n += Math.imul(c, k), n += Math.imul(m, B), q += Math.imul(m, k), z += Math.imul(l, L), n += Math.imul(l, C), n += Math.imul(d,
|
B), n += Math.imul(c, k), n += Math.imul(m, B), q += Math.imul(m, k), Y += Math.imul(l, L), n += Math.imul(l, C), n += Math.imul(d,
|
||||||
L), q += Math.imul(d, C), z += Math.imul(h, T), n += Math.imul(h, j), n += Math.imul(f, T), q += Math.imul(f, j), z += Math.imul(s,
|
L), q += Math.imul(d, C), Y += Math.imul(h, T), n += Math.imul(h, j), n += Math.imul(f, T), q += Math.imul(f, j), Y += Math.imul(s,
|
||||||
F), n += Math.imul(s, R), n += Math.imul(u, F), q += Math.imul(u, R), z += Math.imul(o, O), n += Math.imul(o, P);
|
F), n += Math.imul(s, R), n += Math.imul(u, F), q += Math.imul(u, R), Y += Math.imul(o, O), n += Math.imul(o, P);
|
||||||
var X = t + z + ((8191 & (n += Math.imul(a, O))) << 13);
|
var X = t + Y + ((8191 & (n += Math.imul(a, O))) << 13);
|
||||||
t = (q += Math.imul(a, P)) + (n >>> 13) + (X >>> 26), X &= 67108863, z = Math.imul(b, I), n = Math.imul(b, A), n += Math.imul(v,
|
t = (q += Math.imul(a, P)) + (n >>> 13) + (X >>> 26), X &= 67108863, Y = Math.imul(b, I), n = Math.imul(b, A), n += Math.imul(v,
|
||||||
I), q = Math.imul(v, A), z += Math.imul(_, S), n += Math.imul(_, x), n += Math.imul(y, S), q += Math.imul(y, x), z += Math.imul(p,
|
I), q = Math.imul(v, A), Y += Math.imul(_, S), n += Math.imul(_, x), n += Math.imul(y, S), q += Math.imul(y, x), Y += Math.imul(p,
|
||||||
B), n += Math.imul(p, k), n += Math.imul(g, B), q += Math.imul(g, k), z += Math.imul(c, L), n += Math.imul(c, C), n += Math.imul(m,
|
B), n += Math.imul(p, k), n += Math.imul(g, B), q += Math.imul(g, k), Y += Math.imul(c, L), n += Math.imul(c, C), n += Math.imul(m,
|
||||||
L), q += Math.imul(m, C), z += Math.imul(l, T), n += Math.imul(l, j), n += Math.imul(d, T), q += Math.imul(d, j), z += Math.imul(h,
|
L), q += Math.imul(m, C), Y += Math.imul(l, T), n += Math.imul(l, j), n += Math.imul(d, T), q += Math.imul(d, j), Y += Math.imul(h,
|
||||||
F), n += Math.imul(h, R), n += Math.imul(f, F), q += Math.imul(f, R), z += Math.imul(s, O), n += Math.imul(s, P), n += Math.imul(u,
|
F), n += Math.imul(h, R), n += Math.imul(f, F), q += Math.imul(f, R), Y += Math.imul(s, O), n += Math.imul(s, P), n += Math.imul(u,
|
||||||
O), q += Math.imul(u, P), z += Math.imul(o, N), n += Math.imul(o, D);
|
O), q += Math.imul(u, P), Y += Math.imul(o, N), n += Math.imul(o, D);
|
||||||
var Q = t + z + ((8191 & (n += Math.imul(a, N))) << 13);
|
var Q = t + Y + ((8191 & (n += Math.imul(a, N))) << 13);
|
||||||
t = (q += Math.imul(a, D)) + (n >>> 13) + (Q >>> 26), Q &= 67108863, z = Math.imul(w, I), n = Math.imul(w, A), n += Math.imul(M,
|
t = (q += Math.imul(a, D)) + (n >>> 13) + (Q >>> 26), Q &= 67108863, Y = Math.imul(w, I), n = Math.imul(w, A), n += Math.imul(M,
|
||||||
I), q = Math.imul(M, A), z += Math.imul(b, S), n += Math.imul(b, x), n += Math.imul(v, S), q += Math.imul(v, x), z += Math.imul(_,
|
I), q = Math.imul(M, A), Y += Math.imul(b, S), n += Math.imul(b, x), n += Math.imul(v, S), q += Math.imul(v, x), Y += Math.imul(_,
|
||||||
B), n += Math.imul(_, k), n += Math.imul(y, B), q += Math.imul(y, k), z += Math.imul(p, L), n += Math.imul(p, C), n += Math.imul(g,
|
B), n += Math.imul(_, k), n += Math.imul(y, B), q += Math.imul(y, k), Y += Math.imul(p, L), n += Math.imul(p, C), n += Math.imul(g,
|
||||||
L), q += Math.imul(g, C), z += Math.imul(c, T), n += Math.imul(c, j), n += Math.imul(m, T), q += Math.imul(m, j), z += Math.imul(l,
|
L), q += Math.imul(g, C), Y += Math.imul(c, T), n += Math.imul(c, j), n += Math.imul(m, T), q += Math.imul(m, j), Y += Math.imul(l,
|
||||||
F), n += Math.imul(l, R), n += Math.imul(d, F), q += Math.imul(d, R), z += Math.imul(h, O), n += Math.imul(h, P), n += Math.imul(f,
|
F), n += Math.imul(l, R), n += Math.imul(d, F), q += Math.imul(d, R), Y += Math.imul(h, O), n += Math.imul(h, P), n += Math.imul(f,
|
||||||
O), q += Math.imul(f, P), z += Math.imul(s, N), n += Math.imul(s, D), n += Math.imul(u, N), q += Math.imul(u, D), z += Math.imul(o,
|
O), q += Math.imul(f, P), Y += Math.imul(s, N), n += Math.imul(s, D), n += Math.imul(u, N), q += Math.imul(u, D), Y += Math.imul(o,
|
||||||
U), n += Math.imul(o, K);
|
U), n += Math.imul(o, K);
|
||||||
var tt = t + z + ((8191 & (n += Math.imul(a, U))) << 13);
|
var tt = t + Y + ((8191 & (n += Math.imul(a, U))) << 13);
|
||||||
return t = (q += Math.imul(a, K)) + (n >>> 13) + (tt >>> 26), tt &= 67108863, z = Math.imul(i, I), n = Math.imul(i, A), n += Math.imul(E,
|
return t = (q += Math.imul(a, K)) + (n >>> 13) + (tt >>> 26), tt &= 67108863, Y = Math.imul(i, I), n = Math.imul(i, A), n += Math.imul(E,
|
||||||
I), q = Math.imul(E, A), z += Math.imul(w, S), n += Math.imul(w, x), n += Math.imul(M, S), q += Math.imul(M, x), z += Math.imul(b,
|
I), q = Math.imul(E, A), Y += Math.imul(w, S), n += Math.imul(w, x), n += Math.imul(M, S), q += Math.imul(M, x), Y += Math.imul(b,
|
||||||
B), n += Math.imul(b, k), n += Math.imul(v, B), q += Math.imul(v, k), z += Math.imul(_, L), n += Math.imul(_, C), n += Math.imul(y,
|
B), n += Math.imul(b, k), n += Math.imul(v, B), q += Math.imul(v, k), Y += Math.imul(_, L), n += Math.imul(_, C), n += Math.imul(y,
|
||||||
L), q += Math.imul(y, C), z += Math.imul(p, T), n += Math.imul(p, j), n += Math.imul(g, T), q += Math.imul(g, j), z += Math.imul(c,
|
L), q += Math.imul(y, C), Y += Math.imul(p, T), n += Math.imul(p, j), n += Math.imul(g, T), q += Math.imul(g, j), Y += Math.imul(c,
|
||||||
F), n += Math.imul(c, R), n += Math.imul(m, F), q += Math.imul(m, R), z += Math.imul(l, O), n += Math.imul(l, P), n += Math.imul(d,
|
F), n += Math.imul(c, R), n += Math.imul(m, F), q += Math.imul(m, R), Y += Math.imul(l, O), n += Math.imul(l, P), n += Math.imul(d,
|
||||||
O), q += Math.imul(d, P), z += Math.imul(h, N), n += Math.imul(h, D), n += Math.imul(f, N), q += Math.imul(f, D), z += Math.imul(s,
|
O), q += Math.imul(d, P), Y += Math.imul(h, N), n += Math.imul(h, D), n += Math.imul(f, N), q += Math.imul(f, D), Y += Math.imul(s,
|
||||||
U), n += Math.imul(s, K), n += Math.imul(u, U), q += Math.imul(u, K), z += Math.imul(o, V), n += Math.imul(o, Y), n += Math.imul(a,
|
U), n += Math.imul(s, K), n += Math.imul(u, U), q += Math.imul(u, K), Y += Math.imul(o, V), n += Math.imul(o, z), n += Math.imul(a,
|
||||||
V), t = (q += Math.imul(a, Y)) + (n >>> 13) + ((o = t + z + ((8191 & n) << 13)) >>> 26), o &= 67108863, z = Math.imul(i, S),
|
V), t = (q += Math.imul(a, z)) + (n >>> 13) + ((o = t + Y + ((8191 & n) << 13)) >>> 26), o &= 67108863, Y = Math.imul(i, S),
|
||||||
n = Math.imul(i, x), n += Math.imul(E, S), q = Math.imul(E, x), z += Math.imul(w, B), n += Math.imul(w, k), n += Math.imul(M,
|
n = Math.imul(i, x), n += Math.imul(E, S), q = Math.imul(E, x), Y += Math.imul(w, B), n += Math.imul(w, k), n += Math.imul(M,
|
||||||
B), q += Math.imul(M, k), z += Math.imul(b, L), n += Math.imul(b, C), n += Math.imul(v, L), q += Math.imul(v, C), z += Math.imul(_,
|
B), q += Math.imul(M, k), Y += Math.imul(b, L), n += Math.imul(b, C), n += Math.imul(v, L), q += Math.imul(v, C), Y += Math.imul(_,
|
||||||
T), n += Math.imul(_, j), n += Math.imul(y, T), q += Math.imul(y, j), z += Math.imul(p, F), n += Math.imul(p, R), n += Math.imul(g,
|
T), n += Math.imul(_, j), n += Math.imul(y, T), q += Math.imul(y, j), Y += Math.imul(p, F), n += Math.imul(p, R), n += Math.imul(g,
|
||||||
F), q += Math.imul(g, R), z += Math.imul(c, O), n += Math.imul(c, P), n += Math.imul(m, O), q += Math.imul(m, P), z += Math.imul(l,
|
F), q += Math.imul(g, R), Y += Math.imul(c, O), n += Math.imul(c, P), n += Math.imul(m, O), q += Math.imul(m, P), Y += Math.imul(l,
|
||||||
N), n += Math.imul(l, D), n += Math.imul(d, N), q += Math.imul(d, D), z += Math.imul(h, U), n += Math.imul(h, K), n += Math.imul(f,
|
N), n += Math.imul(l, D), n += Math.imul(d, N), q += Math.imul(d, D), Y += Math.imul(h, U), n += Math.imul(h, K), n += Math.imul(f,
|
||||||
U), q += Math.imul(f, K), z += Math.imul(s, V), n += Math.imul(s, Y), n += Math.imul(u, V), t = (q += Math.imul(u, Y)) + (n >>> 13) + ((s = t + z + ((8191 & n) << 13)) >>> 26),
|
U), q += Math.imul(f, K), Y += Math.imul(s, V), n += Math.imul(s, z), n += Math.imul(u, V), t = (q += Math.imul(u, z)) + (n >>> 13) + ((s = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
s &= 67108863, z = Math.imul(i, B), n = Math.imul(i, k), n += Math.imul(E, B), q = Math.imul(E, k), z += Math.imul(w, L), n += Math.imul(w,
|
s &= 67108863, Y = Math.imul(i, B), n = Math.imul(i, k), n += Math.imul(E, B), q = Math.imul(E, k), Y += Math.imul(w, L), n += Math.imul(w,
|
||||||
C), n += Math.imul(M, L), q += Math.imul(M, C), z += Math.imul(b, T), n += Math.imul(b, j), n += Math.imul(v, T), q += Math.imul(v,
|
C), n += Math.imul(M, L), q += Math.imul(M, C), Y += Math.imul(b, T), n += Math.imul(b, j), n += Math.imul(v, T), q += Math.imul(v,
|
||||||
j), z += Math.imul(_, F), n += Math.imul(_, R), n += Math.imul(y, F), q += Math.imul(y, R), z += Math.imul(p, O), n += Math.imul(p,
|
j), Y += Math.imul(_, F), n += Math.imul(_, R), n += Math.imul(y, F), q += Math.imul(y, R), Y += Math.imul(p, O), n += Math.imul(p,
|
||||||
P), n += Math.imul(g, O), q += Math.imul(g, P), z += Math.imul(c, N), n += Math.imul(c, D), n += Math.imul(m, N), q += Math.imul(m,
|
P), n += Math.imul(g, O), q += Math.imul(g, P), Y += Math.imul(c, N), n += Math.imul(c, D), n += Math.imul(m, N), q += Math.imul(m,
|
||||||
D), z += Math.imul(l, U), n += Math.imul(l, K), n += Math.imul(d, U), q += Math.imul(d, K), z += Math.imul(h, V), n += Math.imul(h,
|
D), Y += Math.imul(l, U), n += Math.imul(l, K), n += Math.imul(d, U), q += Math.imul(d, K), Y += Math.imul(h, V), n += Math.imul(h,
|
||||||
Y), n += Math.imul(f, V), t = (q += Math.imul(f, Y)) + (n >>> 13) + ((h = t + z + ((8191 & n) << 13)) >>> 26), h &= 67108863,
|
z), n += Math.imul(f, V), t = (q += Math.imul(f, z)) + (n >>> 13) + ((h = t + Y + ((8191 & n) << 13)) >>> 26), h &= 67108863,
|
||||||
z = Math.imul(i, L), n = Math.imul(i, C), n += Math.imul(E, L), q = Math.imul(E, C), z += Math.imul(w, T), n += Math.imul(w,
|
Y = Math.imul(i, L), n = Math.imul(i, C), n += Math.imul(E, L), q = Math.imul(E, C), Y += Math.imul(w, T), n += Math.imul(w,
|
||||||
j), n += Math.imul(M, T), q += Math.imul(M, j), z += Math.imul(b, F), n += Math.imul(b, R), n += Math.imul(v, F), q += Math.imul(v,
|
j), n += Math.imul(M, T), q += Math.imul(M, j), Y += Math.imul(b, F), n += Math.imul(b, R), n += Math.imul(v, F), q += Math.imul(v,
|
||||||
R), z += Math.imul(_, O), n += Math.imul(_, P), n += Math.imul(y, O), q += Math.imul(y, P), z += Math.imul(p, N), n += Math.imul(p,
|
R), Y += Math.imul(_, O), n += Math.imul(_, P), n += Math.imul(y, O), q += Math.imul(y, P), Y += Math.imul(p, N), n += Math.imul(p,
|
||||||
D), n += Math.imul(g, N), q += Math.imul(g, D), z += Math.imul(c, U), n += Math.imul(c, K), n += Math.imul(m, U), q += Math.imul(m,
|
D), n += Math.imul(g, N), q += Math.imul(g, D), Y += Math.imul(c, U), n += Math.imul(c, K), n += Math.imul(m, U), q += Math.imul(m,
|
||||||
K), z += Math.imul(l, V), n += Math.imul(l, Y), n += Math.imul(d, V), t = (q += Math.imul(d, Y)) + (n >>> 13) + ((l = t + z + ((8191 & n) << 13)) >>> 26),
|
K), Y += Math.imul(l, V), n += Math.imul(l, z), n += Math.imul(d, V), t = (q += Math.imul(d, z)) + (n >>> 13) + ((l = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
l &= 67108863, z = Math.imul(i, T), n = Math.imul(i, j), n += Math.imul(E, T), q = Math.imul(E, j), z += Math.imul(w, F), n += Math.imul(w,
|
l &= 67108863, Y = Math.imul(i, T), n = Math.imul(i, j), n += Math.imul(E, T), q = Math.imul(E, j), Y += Math.imul(w, F), n += Math.imul(w,
|
||||||
R), n += Math.imul(M, F), q += Math.imul(M, R), z += Math.imul(b, O), n += Math.imul(b, P), n += Math.imul(v, O), q += Math.imul(v,
|
R), n += Math.imul(M, F), q += Math.imul(M, R), Y += Math.imul(b, O), n += Math.imul(b, P), n += Math.imul(v, O), q += Math.imul(v,
|
||||||
P), z += Math.imul(_, N), n += Math.imul(_, D), n += Math.imul(y, N), q += Math.imul(y, D), z += Math.imul(p, U), n += Math.imul(p,
|
P), Y += Math.imul(_, N), n += Math.imul(_, D), n += Math.imul(y, N), q += Math.imul(y, D), Y += Math.imul(p, U), n += Math.imul(p,
|
||||||
K), n += Math.imul(g, U), q += Math.imul(g, K), z += Math.imul(c, V), n += Math.imul(c, Y), n += Math.imul(m, V), t = (q += Math.imul(m,
|
K), n += Math.imul(g, U), q += Math.imul(g, K), Y += Math.imul(c, V), n += Math.imul(c, z), n += Math.imul(m, V), t = (q += Math.imul(m,
|
||||||
Y)) + (n >>> 13) + ((c = t + z + ((8191 & n) << 13)) >>> 26), c &= 67108863, z = Math.imul(i, F), n = Math.imul(i, R), n += Math.imul(E,
|
z)) + (n >>> 13) + ((c = t + Y + ((8191 & n) << 13)) >>> 26), c &= 67108863, Y = Math.imul(i, F), n = Math.imul(i, R), n += Math.imul(E,
|
||||||
F), q = Math.imul(E, R), z += Math.imul(w, O), n += Math.imul(w, P), n += Math.imul(M, O), q += Math.imul(M, P), z += Math.imul(b,
|
F), q = Math.imul(E, R), Y += Math.imul(w, O), n += Math.imul(w, P), n += Math.imul(M, O), q += Math.imul(M, P), Y += Math.imul(b,
|
||||||
N), n += Math.imul(b, D), n += Math.imul(v, N), q += Math.imul(v, D), z += Math.imul(_, U), n += Math.imul(_, K), n += Math.imul(y,
|
N), n += Math.imul(b, D), n += Math.imul(v, N), q += Math.imul(v, D), Y += Math.imul(_, U), n += Math.imul(_, K), n += Math.imul(y,
|
||||||
U), q += Math.imul(y, K), z += Math.imul(p, V), n += Math.imul(p, Y), n += Math.imul(g, V), t = (q += Math.imul(g, Y)) + (n >>> 13) + ((p = t + z + ((8191 & n) << 13)) >>> 26),
|
U), q += Math.imul(y, K), Y += Math.imul(p, V), n += Math.imul(p, z), n += Math.imul(g, V), t = (q += Math.imul(g, z)) + (n >>> 13) + ((p = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
p &= 67108863, z = Math.imul(i, O), n = Math.imul(i, P), n += Math.imul(E, O), q = Math.imul(E, P), z += Math.imul(w, N), n += Math.imul(w,
|
p &= 67108863, Y = Math.imul(i, O), n = Math.imul(i, P), n += Math.imul(E, O), q = Math.imul(E, P), Y += Math.imul(w, N), n += Math.imul(w,
|
||||||
D), n += Math.imul(M, N), q += Math.imul(M, D), z += Math.imul(b, U), n += Math.imul(b, K), n += Math.imul(v, U), q += Math.imul(v,
|
D), n += Math.imul(M, N), q += Math.imul(M, D), Y += Math.imul(b, U), n += Math.imul(b, K), n += Math.imul(v, U), q += Math.imul(v,
|
||||||
K), z += Math.imul(_, V), n += Math.imul(_, Y), n += Math.imul(y, V), t = (q += Math.imul(y, Y)) + (n >>> 13) + ((_ = t + z + ((8191 & n) << 13)) >>> 26),
|
K), Y += Math.imul(_, V), n += Math.imul(_, z), n += Math.imul(y, V), t = (q += Math.imul(y, z)) + (n >>> 13) + ((_ = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
_ &= 67108863, z = Math.imul(i, N), n = Math.imul(i, D), n += Math.imul(E, N), q = Math.imul(E, D), z += Math.imul(w, U), n += Math.imul(w,
|
_ &= 67108863, Y = Math.imul(i, N), n = Math.imul(i, D), n += Math.imul(E, N), q = Math.imul(E, D), Y += Math.imul(w, U), n += Math.imul(w,
|
||||||
K), n += Math.imul(M, U), q += Math.imul(M, K), z += Math.imul(b, V), n += Math.imul(b, Y), n += Math.imul(v, V), t = (q += Math.imul(v,
|
K), n += Math.imul(M, U), q += Math.imul(M, K), Y += Math.imul(b, V), n += Math.imul(b, z), n += Math.imul(v, V), t = (q += Math.imul(v,
|
||||||
Y)) + (n >>> 13) + ((b = t + z + ((8191 & n) << 13)) >>> 26), b &= 67108863, z = Math.imul(i, U), n = Math.imul(i, K), n += Math.imul(E,
|
z)) + (n >>> 13) + ((b = t + Y + ((8191 & n) << 13)) >>> 26), b &= 67108863, Y = Math.imul(i, U), n = Math.imul(i, K), n += Math.imul(E,
|
||||||
U), q = Math.imul(E, K), z += Math.imul(w, V), n += Math.imul(w, Y), n += Math.imul(M, V), t = (q += Math.imul(M, Y)) + (n >>> 13) + ((w = t + z + ((8191 & n) << 13)) >>> 26),
|
U), q = Math.imul(E, K), Y += Math.imul(w, V), n += Math.imul(w, z), n += Math.imul(M, V), t = (q += Math.imul(M, z)) + (n >>> 13) + ((w = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
w &= 67108863, z = Math.imul(i, V), n = Math.imul(i, Y), n += Math.imul(E, V), t = (q = Math.imul(E, Y)) + (n >>> 13) + ((a = t + z + ((8191 & n) << 13)) >>> 26),
|
w &= 67108863, Y = Math.imul(i, V), n = Math.imul(i, z), n += Math.imul(E, V), t = (q = Math.imul(E, z)) + (n >>> 13) + ((a = t + Y + ((8191 & n) << 13)) >>> 26),
|
||||||
e[0] = $, e[1] = W, e[2] = Z, e[3] = G, e[4] = H, e[5] = J, e[6] = X, e[7] = Q, e[8] = tt, e[9] = o, e[10] = s, e[11] = h,
|
e[0] = $, e[1] = W, e[2] = Z, e[3] = G, e[4] = H, e[5] = J, e[6] = X, e[7] = Q, e[8] = tt, e[9] = o, e[10] = s, e[11] = h,
|
||||||
e[12] = l, e[13] = c, e[14] = p, e[15] = _, e[16] = b, e[17] = w, e[18] = 67108863 & a, 0 !== t && (e[19] = t, r.length++),
|
e[12] = l, e[13] = c, e[14] = p, e[15] = _, e[16] = b, e[17] = w, e[18] = 67108863 & a, 0 !== t && (e[19] = t, r.length++),
|
||||||
r;
|
r;
|
||||||
@ -2937,7 +2938,8 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, {}], 45: [function(t, e, r) {
|
}, {}], 45: [function(t, e, r) {
|
||||||
|
|
||||||
function a(t, e, r) {
|
function a(t, e, r) {
|
||||||
this.z = null === t && null === e && null === r ? (this.y = this.x = a.one, a.zero) : (this.x = t, this.y = e, r), this.zOne = this.z === a.one;
|
null === t && null === e && null === r ? (this.y = this.x = a.one, this.z = a.zero) : (this.x = t, this.y = e, this.z = r),
|
||||||
|
this.zOne = this.z === a.one;
|
||||||
};
|
};
|
||||||
t = t("./bn"), a.zero = t.fromNumber(0), a.one = t.fromNumber(1), a.prototype.neg = function() {
|
t = t("./bn"), a.zero = t.fromNumber(0), a.one = t.fromNumber(1), a.prototype.neg = function() {
|
||||||
return this.inf ? this : new a(this.x, this.y.redNeg(), this.z);
|
return this.inf ? this : new a(this.x, this.y.redNeg(), this.z);
|
||||||
@ -2991,7 +2993,7 @@ $jscomp.scope = {}, $jscomp.arrayIteratorImpl = function(t) {
|
|||||||
}, { "./bn": 43 }], 46: [function(t, e, r) {
|
}, { "./bn": 43 }], 46: [function(t, e, r) {
|
||||||
|
|
||||||
function s(t, e) {
|
function s(t, e) {
|
||||||
this.inf = null === t && null === e ? (this.x = this.y = null, !0) : (this.x = t, this.y = e, !1);
|
null === t && null === e ? (this.x = this.y = null, this.inf = !0) : (this.x = t, this.y = e, this.inf = !1);
|
||||||
};
|
};
|
||||||
var i = t("safe-buffer").Buffer, n = t("./bn"), o = t("./ecjpoint");
|
var i = t("safe-buffer").Buffer, n = t("./bn"), o = t("./ecjpoint");
|
||||||
s.fromPublicKey = function(t) {
|
s.fromPublicKey = function(t) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<html>
|
<html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>TERA</title>
|
<title>TERA</title>
|
||||||
@ -319,7 +320,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
//Pagination
|
//Pagination
|
||||||
var CountViewRows=20;
|
var CountViewRows=20;
|
||||||
var DefAccounts={BlockName:"idPaginationAccount", NumName:"idViewAccountNum", TabName:"grid_accounts_all",APIName:"GetAccountList",Param3:"",FilterName:"idViewAccountFilter",TotalSum:"idTotalSum"};
|
var DefAccounts={BlockName:"idPaginationAccount", NumName:"idViewAccountNum", TabName:"grid_accounts_all",APIName:"GetAccountList",Param3:"",FilterName:"idViewAccountFilter",TotalSum:"idTotalSum"};
|
||||||
@ -391,7 +391,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
/*Get data from server Get data from server Get data from server Get data from server Get data from server */
|
/*Get data from server Get data from server Get data from server Get data from server Get data from server */
|
||||||
function UpdatesConfigData()
|
function UpdatesConfigData()
|
||||||
{
|
{
|
||||||
@ -537,8 +536,8 @@
|
|||||||
document.getElementById("idPubKey").innerText=PubKeyStr;
|
document.getElementById("idPubKey").innerText=PubKeyStr;
|
||||||
if(document.getElementById("idDataPath").innerText!==Data.DATA_PATH)
|
if(document.getElementById("idDataPath").innerText!==Data.DATA_PATH)
|
||||||
document.getElementById("idDataPath").innerText=Data.DATA_PATH;
|
document.getElementById("idDataPath").innerText=Data.DATA_PATH;
|
||||||
if(document.getElementById("idNodeAddr").innerText!==Data.NodeAddrStr)
|
// if(document.getElementById("idNodeAddr").innerText!==Data.NodeAddrStr)
|
||||||
document.getElementById("idNodeAddr").innerText=Data.NodeAddrStr;
|
// document.getElementById("idNodeAddr").innerText=Data.NodeAddrStr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -643,8 +642,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
//LIB
|
//LIB
|
||||||
function ConfirmationFromBlock(BlockNum)
|
function ConfirmationFromBlock(BlockNum)
|
||||||
{
|
{
|
||||||
@ -1310,20 +1307,17 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
table.password {
|
||||||
table.password
|
|
||||||
{
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#idOpenWallet
|
#idOpenWallet {
|
||||||
{
|
z-index: 1001;
|
||||||
z-index:1001;
|
position: relative;
|
||||||
position:relative;
|
|
||||||
float: right;
|
float: right;
|
||||||
top:15px;
|
top: 15px;
|
||||||
right:0px;
|
right: 0px;
|
||||||
padding: 0 0 0 20px;
|
padding: 0 0 0 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0 0 0 1px;
|
box-shadow: 0 0 0 1px;
|
||||||
@ -1341,14 +1335,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#idBlockPasswordSet,#idBlockPasswordGet
|
#idBlockPasswordSet,
|
||||||
{
|
#idBlockPasswordGet {
|
||||||
z-index:1000;
|
z-index: 1000;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
top:150px;
|
top: 150px;
|
||||||
right:25%;
|
right: 25%;
|
||||||
height:150px;
|
height: 150px;
|
||||||
width:320px;
|
width: 320px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background: #d9d9d9;
|
background: #d9d9d9;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -1358,18 +1352,15 @@
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style id="idHintStyle">
|
<style id="idHintStyle">
|
||||||
th.hint:hover:after
|
th.hint:hover:after {
|
||||||
{
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: attr(data-name);
|
content: attr(data-name);
|
||||||
background: #f7efa3;
|
background: #f7efa3;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size:smaller;
|
font-size: smaller;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 1px solid #3b1c0e;
|
border: 1px solid #3b1c0e;
|
||||||
@ -1381,23 +1372,30 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.red
|
.red {
|
||||||
{
|
color: red;
|
||||||
color:red;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<DIV align='center'>
|
<DIV align='center'>
|
||||||
<DIV align='left' style="width: 800px;border2: 1px solid #727473;">
|
<DIV align='left' style="width: 800px;border2: 1px solid #727473;">
|
||||||
|
|
||||||
<table id="TabHeader">
|
<table id="TabHeader">
|
||||||
<tr>
|
<tr>
|
||||||
<th><DIV id="MTabAccounts" onclick="SelectTab('TabAccounts')" class="bttab">CONFIG</DIV></th>
|
<th>
|
||||||
<th><DIV id="MTabSend" onclick="SelectTab('TabSend')" class="bttab">SEND</DIV></th>
|
<DIV id="MTabAccounts" onclick="SelectTab('TabAccounts')" class="bttab">配置</DIV>
|
||||||
<th><DIV id="MTabDapps" onclick="SelectTab('TabDapps')" class="bttab">DApps</DIV></th>
|
</th>
|
||||||
<th><DIV id="MTabExplorer" onclick="SelectTab('TabExplorer')" class="bttab">EXPLORER</DIV></th>
|
<th>
|
||||||
|
<DIV id="MTabSend" onclick="SelectTab('TabSend')" class="bttab">发送</DIV>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<DIV id="MTabDapps" onclick="SelectTab('TabDapps')" class="bttab">分布式应用</DIV>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<DIV id="MTabExplorer" onclick="SelectTab('TabExplorer')" class="bttab">浏览器</DIV>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -1411,14 +1409,18 @@
|
|||||||
<DIV id="idNodeUpdateMiningStatus" style="display: block">
|
<DIV id="idNodeUpdateMiningStatus" style="display: block">
|
||||||
<DIV style="float: left">
|
<DIV style="float: left">
|
||||||
<input type="checkbox" class="checkbox" id="idAutoUpdate" onchange = "UseAutoUpdate()"/>
|
<input type="checkbox" class="checkbox" id="idAutoUpdate" onchange = "UseAutoUpdate()"/>
|
||||||
<label for="idAutoUpdate">Autoupdate</label>
|
<label for="idAutoUpdate">自动更新</label>
|
||||||
</DIV>
|
</DIV>
|
||||||
<DIV style="float: left">
|
<DIV style="float: left">
|
||||||
<input type="checkbox" class="checkbox" id="idUseMining" onchange = "UseMining()"/>
|
<input type="checkbox" class="checkbox" id="idUseMining" onchange = "UseMining()"/>
|
||||||
<label for="idUseMining">Mining</label>
|
<label for="idUseMining">挖矿</label>
|
||||||
|
</DIV>
|
||||||
|
<DIV style="float: left">
|
||||||
|
<label>此版本由 MiaoWoo 使用 TypeScript 重构</label>
|
||||||
</DIV>
|
</DIV>
|
||||||
<DIV style="float: left;display: none" id="idMiningParams">
|
<DIV style="float: left;display: none" id="idMiningParams">
|
||||||
<DIV style="float: left; color: blue;">CPU use:<input type="number" min=0 max=100 id="idPercentMining" onchange="SetPercentMining()"/>%</DIV>
|
<DIV style="float: left; color: blue;">CPU
|
||||||
|
use:<input type="number" min=0 max=100 id="idPercentMining" onchange="SetPercentMining()"/>%</DIV>
|
||||||
<DIV style="float: left; margin: 2px 0 0 8px;" id="idStatusMining"></DIV>
|
<DIV style="float: left; margin: 2px 0 0 8px;" id="idStatusMining"></DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
@ -1468,24 +1470,25 @@
|
|||||||
Max:<B id="idSpeedSignLib" style="cursor: pointer" onclick='TestSignLib()'></B> tps
|
Max:<B id="idSpeedSignLib" style="cursor: pointer" onclick='TestSignLib()'></B> tps
|
||||||
</DIV>
|
</DIV>
|
||||||
<DIV id="idSignLibError" style="display: none;">
|
<DIV id="idSignLibError" style="display: none;">
|
||||||
<BR><BR><DIV align='center' style="border: 1px solid #ff791a;padding: 5px"><b class="red">*************** WARNING: VERY SLOW LIBRARY: secp256k1 ***************<BR>Install all dependent packages, see detail: <a href="https://www.npmjs.com/package/secp256k1">https://www.npmjs.com/package/secp256k1</a></b>
|
<BR><BR>
|
||||||
|
<DIV align='center' style="border: 1px solid #ff791a;padding: 5px">
|
||||||
|
<b class="red">*************** WARNING: VERY SLOW LIBRARY: secp256k1 ***************<BR>Install all dependent packages, see detail: <a href="https://www.npmjs.com/package/secp256k1">https://www.npmjs.com/package/secp256k1</a></b>
|
||||||
</DIV>
|
</DIV>
|
||||||
<BR>
|
<BR>
|
||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
|
|
||||||
<DIV id="wallet_config_tab" style="display: none;float: left">
|
<DIV id="wallet_config_tab" style="display: none;float: left">
|
||||||
Wallet data path: <B id="idDataPath"></B><BR>
|
钱包数据目录: <B id="idDataPath"></B><BR>
|
||||||
Public key: <B id="idPubKey"></B><BR>
|
账户公钥: <B id="idPubKey"></B><BR>
|
||||||
Node addr: <B id="idNodeAddr"></B>
|
<!--Node addr: <B id="idNodeAddr"></B><BR>-->
|
||||||
<BR>
|
|
||||||
|
|
||||||
|
|
||||||
<INPUT type="button" onclick="MoveUp($('edit_keys'));NewPrivateKey();" class="btdoit bt" value="New wallet..." id="idDown2">
|
<INPUT type="button" onclick="MoveUp($('edit_keys'));NewPrivateKey();" class="btdoit bt" value="新建钱包" id="idDown2">
|
||||||
<INPUT type="button" onclick="MoveUp($('edit_keys'));EditPrivateKey();SetImg(this,'edit_keys');" class="btdoit bt" value="Edit wallet" id="idDown">
|
<INPUT type="button" onclick="MoveUp($('edit_keys'));EditPrivateKey();SetImg(this,'edit_keys');" class="btdoit bt" value="编辑钱包" id="idDown">
|
||||||
<INPUT type="button" onclick="MoveUp($('idAccountEdit'));ViewNewAccount();SetImg(this,'idAccountEdit');" class="btdoit bt" value="New account" id="idDown">
|
<INPUT type="button" onclick="MoveUp($('idAccountEdit'));ViewNewAccount();SetImg(this,'idAccountEdit');" class="btdoit bt" value="新建账户" id="idDown">
|
||||||
<INPUT type="button" onclick="MoveUp($('edit_mining_set'));MiningSets();SetImg(this,'edit_mining_set');" class="btdoit bt" value="Set mining" id="idDown">
|
<INPUT type="button" onclick="MoveUp($('edit_mining_set'));MiningSets();SetImg(this,'edit_mining_set');" class="btdoit bt" value="设置挖矿账号" id="idDown">
|
||||||
<INPUT type="button" onclick="ViewSetPassword();itemBtPassword=this; SetImg(itemBtPassword,'idBlockPasswordSet');" class="bt btdoit" value="Set password" id="idDown">
|
<INPUT type="button" onclick="ViewSetPassword();itemBtPassword=this; SetImg(itemBtPassword,'idBlockPasswordSet');" class="bt btdoit" value="设置密码" id="idDown">
|
||||||
|
|
||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
@ -1494,7 +1497,10 @@
|
|||||||
<DIV id="edit_mining_set" style="display: none">
|
<DIV id="edit_mining_set" style="display: none">
|
||||||
<table class="form_input keys" id="grid_mining_set">
|
<table class="form_input keys" id="grid_mining_set">
|
||||||
<tr>
|
<tr>
|
||||||
<td><DIV>Mining account:</DIV></td><td><INPUT type="number" id="idMiningAccount" min=0 max=1000000000000 value="0"></td>
|
<td>
|
||||||
|
<DIV>Mining account:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="number" id="idMiningAccount" min=0 max=1000000000000 value="0"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -1514,7 +1520,8 @@
|
|||||||
<option value="public">Public key (sign from another wallet)</option>
|
<option value="public">Public key (sign from another wallet)</option>
|
||||||
<option value="brain">Brain key generator</option>
|
<option value="brain">Brain key generator</option>
|
||||||
</select>
|
</select>
|
||||||
</td><td><INPUT type="string" autocomplete="off" id="idKeyNew" value=""></td>
|
</td>
|
||||||
|
<td><INPUT type="string" autocomplete="off" id="idKeyNew" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="idViewKeyNew2" style="display: none">
|
<tr id="idViewKeyNew2" style="display: none">
|
||||||
<td>You can repeat the secret words:</td>
|
<td>You can repeat the secret words:</td>
|
||||||
@ -1535,7 +1542,9 @@
|
|||||||
<DIV id="idAccountEdit" style="display: none">
|
<DIV id="idAccountEdit" style="display: none">
|
||||||
<table class="form_input keys" id="grid_edit_newacc">
|
<table class="form_input keys" id="grid_edit_newacc">
|
||||||
<tr>
|
<tr>
|
||||||
<td><DIV>Public name:</DIV></td>
|
<td>
|
||||||
|
<DIV>Public name:</DIV>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<INPUT type="string" maxlength="40" autocomplete="off" id="idAccountName" onkeyup="CheckLengthAccDesription('idAccountName',40)" value="">
|
<INPUT type="string" maxlength="40" autocomplete="off" id="idAccountName" onkeyup="CheckLengthAccDesription('idAccountName',40)" value="">
|
||||||
</td>
|
</td>
|
||||||
@ -1548,12 +1557,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<DIV>Currency:</DIV></td><td><INPUT type="number" id="idCurrency" min=0 max=1000000000 value="0">
|
<DIV>Currency:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="number" id="idCurrency" min=0 max=1000000000 value="0">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<DIV>Smart:</DIV></td><td><INPUT type="number" id="idSmart" min=0 max=1000000000 value="0">
|
<DIV>Smart:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="number" id="idSmart" min=0 max=1000000000 value="0">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!--<tr>-->
|
<!--<tr>-->
|
||||||
@ -1562,7 +1575,9 @@
|
|||||||
|
|
||||||
<tr id="idRowWN" style="display: none">
|
<tr id="idRowWN" style="display: none">
|
||||||
<td>
|
<td>
|
||||||
<DIV>Wallet number:</DIV></td><td><INPUT type="number" id="idWN" min=0 max=100 value="0">
|
<DIV>Wallet number:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="number" id="idWN" min=0 max=100 value="0">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -1587,9 +1602,11 @@
|
|||||||
<th id="CurrencyNameItem(Item)" data-name="Currency" class="cur hint">Cur</th>
|
<th id="CurrencyNameItem(Item)" data-name="Currency" class="cur hint">Cur</th>
|
||||||
<th id="Item.Name" data-name="Account name" class="accname hint">Name</th>
|
<th id="Item.Name" data-name="Account name" class="accname hint">Name</th>
|
||||||
<th id="Item.Value.OperationID" data-name="Operation ID" class="snum hint">OP</th>
|
<th id="Item.Value.OperationID" data-name="Operation ID" class="snum hint">OP</th>
|
||||||
<th id="(RetHistoryAccount(Item,'Adviser'))" data-name="Adviser" class="snum hint">Adv</th>
|
<th id="(RetHistoryAccount(Item,'Adviser'))" data-name="Adviser" class="snum hint">
|
||||||
|
Adv</th>
|
||||||
|
|
||||||
<th id="(RetChangeSmart(Item))" data-name="Smart contract (DApp)" class="smart hint">Smart</th>
|
<th id="(RetChangeSmart(Item))" data-name="Smart contract (DApp)"
|
||||||
|
class="smart hint">Smart</th>
|
||||||
<th id="Item.WN" class="num" style="width: 30px;"></th>
|
<th id="Item.WN" class="num" style="width: 30px;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -1681,7 +1698,12 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td> </td><td><DIV id="idNameTo" class="smallbold"></DIV></td></tr>
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>
|
||||||
|
<DIV id="idNameTo" class="smallbold"></DIV>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Pay to</td>
|
<td>Pay to</td>
|
||||||
<td>
|
<td>
|
||||||
@ -1697,8 +1719,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Description (optional)</td><td><textarea id="idDescription" rows="4" onkeyup="CheckLengthAccDesription('idDescription',200);OnEditTransactionFields()" onchange="OnEditTransactionFields()"></textarea></td>
|
<td>Description (optional)</td>
|
||||||
<td><DIV id="idAttach"> </DIV></td>
|
<td><textarea id="idDescription" rows="4" onkeyup="CheckLengthAccDesription('idDescription',200);OnEditTransactionFields()" onchange="OnEditTransactionFields()"></textarea>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<DIV id="idAttach"> </DIV>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -1812,7 +1838,7 @@
|
|||||||
<DIV>
|
<DIV>
|
||||||
<DIV id="idPaginationAccount" style="display: none">
|
<DIV id="idPaginationAccount" style="display: none">
|
||||||
<HR>
|
<HR>
|
||||||
<DIV id="view_header" >Accounts</DIV><BR>
|
<DIV id="view_header">Accounts</DIV><BR>
|
||||||
Search:<INPUT type="search" id="idViewAccountFilter" value="" onchange="CheckNewSearch(DefAccounts); ViewCurrent(DefAccounts)">
|
Search:<INPUT type="search" id="idViewAccountFilter" value="" onchange="CheckNewSearch(DefAccounts); ViewCurrent(DefAccounts)">
|
||||||
<INPUT type="button" onclick="ViewBegin(DefAccounts)" class="btdoitm bt" value="|<-">
|
<INPUT type="button" onclick="ViewBegin(DefAccounts)" class="btdoitm bt" value="|<-">
|
||||||
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="<< Prev">
|
||||||
@ -1828,9 +1854,11 @@
|
|||||||
<th id="Item.Name" class="accname">Name</th>
|
<th id="Item.Name" class="accname">Name</th>
|
||||||
<th id="Item.PubKeyStr" class="pubkey">PubKey</th>
|
<th id="Item.PubKeyStr" class="pubkey">PubKey</th>
|
||||||
<th id="Item.Value.OperationID" class="num">Operation</th>
|
<th id="Item.Value.OperationID" class="num">Operation</th>
|
||||||
<th id="(RetHistoryAccount(Item,'Adviser'))" class="num">Adviser</th>
|
<th id="(RetHistoryAccount(Item,'Adviser'))" class="num">Adviser
|
||||||
|
</th>
|
||||||
<th id="Item.Value.Smart" class="num">Smart</th>
|
<th id="Item.Value.Smart" class="num">Smart</th>
|
||||||
<th id="(RetOpenBlock(Item.BlockNumCreate,1))" class="num">Block Num</th>
|
<th id="(RetOpenBlock(Item.BlockNumCreate,1))" class="num">Block Num
|
||||||
|
</th>
|
||||||
<!--<th id="Item.Arr[0].BlockNum" class="num">0</th>-->
|
<!--<th id="Item.Arr[0].BlockNum" class="num">0</th>-->
|
||||||
<!--<th id="Item.Arr[1].BlockNum" class="num">1</th>-->
|
<!--<th id="Item.Arr[1].BlockNum" class="num">1</th>-->
|
||||||
<!--<th id="Item.Arr[2].BlockNum" class="num">2</th>-->
|
<!--<th id="Item.Arr[2].BlockNum" class="num">2</th>-->
|
||||||
@ -1849,7 +1877,7 @@
|
|||||||
|
|
||||||
<DIV id="idPaginationBlock" style="display: none">
|
<DIV id="idPaginationBlock" style="display: none">
|
||||||
<HR>
|
<HR>
|
||||||
<DIV id="view_header" >Blocks<BR></DIV>
|
<DIV id="view_header">Blocks<BR></DIV>
|
||||||
<!--<DIV id="idFilterB">JS:<INPUT type="search" id="idViewBlockFilter" value="" onchange="ViewCurrent(DefBlock)"></DIV>-->
|
<!--<DIV id="idFilterB">JS:<INPUT type="search" id="idViewBlockFilter" value="" onchange="ViewCurrent(DefBlock)"></DIV>-->
|
||||||
<INPUT type="button" onclick="ViewBegin(DefBlock)" class="btdoitm bt" value="|<-">
|
<INPUT type="button" onclick="ViewBegin(DefBlock)" class="btdoitm bt" value="|<-">
|
||||||
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="<< Prev">
|
||||||
@ -1860,15 +1888,21 @@
|
|||||||
<table id="grid_block_all" class="grid">
|
<table id="grid_block_all" class="grid">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))" class="num">Num</th>
|
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))"
|
||||||
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">Date</th>
|
class="num">Num</th>
|
||||||
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash</th>
|
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">Date
|
||||||
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash</th>
|
</th>
|
||||||
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash</th>
|
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash
|
||||||
|
</th>
|
||||||
|
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash
|
||||||
|
</th>
|
||||||
|
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash
|
||||||
|
</th>
|
||||||
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
|
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
|
||||||
<th id="Item.TrDataLen" class="num">Bytes</th>
|
<th id="Item.TrDataLen" class="num">Bytes</th>
|
||||||
<th id="Item.Power" class="num">Pow</th>
|
<th id="Item.Power" class="num">Pow</th>
|
||||||
<th id="(RetHistoryAccount(Item,'Miner')+'<BR>'+Item.MinerName)" class="num">Miner</th>
|
<th id="(RetHistoryAccount(Item,'Miner')+'<BR><b>'+Item.MinerName)+'</b>'"
|
||||||
|
class="num">Miner</th>
|
||||||
|
|
||||||
|
|
||||||
<!--<th id="GetHexFromArr(Item.Hash1)" class="hash">Hash1</th>-->
|
<!--<th id="GetHexFromArr(Item.Hash1)" class="hash">Hash1</th>-->
|
||||||
@ -1893,7 +1927,7 @@
|
|||||||
|
|
||||||
<DIV id="idPaginationAct" style="display: none">
|
<DIV id="idPaginationAct" style="display: none">
|
||||||
<HR>
|
<HR>
|
||||||
<DIV id="view_header" >Accounts acts<BR></DIV>
|
<DIV id="view_header">Accounts acts<BR></DIV>
|
||||||
<INPUT type="button" onclick="ViewBegin(DefActs)" class="btdoitm bt" value="|<-">
|
<INPUT type="button" onclick="ViewBegin(DefActs)" class="btdoitm bt" value="|<-">
|
||||||
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="<< Prev">
|
||||||
<INPUT type="number" id="idViewActNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefActs)">
|
<INPUT type="number" id="idViewActNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefActs)">
|
||||||
@ -1906,13 +1940,18 @@
|
|||||||
<th id="Item.Num" class="num">Num</th>
|
<th id="Item.Num" class="num">Num</th>
|
||||||
<th id="Item.ID" class="num">Account</th>
|
<th id="Item.ID" class="num">Account</th>
|
||||||
<th id="Item.Mode">Mode</th>
|
<th id="Item.Mode">Mode</th>
|
||||||
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block</th>
|
<th id="(RetOpenBlock(Item.BlockNum,1))"
|
||||||
|
class="num">Block</th>
|
||||||
<th id="Item.TrNum" class="num">TrNum</th>
|
<th id="Item.TrNum" class="num">TrNum</th>
|
||||||
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
|
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
|
||||||
|
class="date">Date</th>
|
||||||
|
|
||||||
<th id="Item.PrevValue.OperationID" class="num">Prev. Operation</th>
|
<th id="Item.PrevValue.OperationID" class="num">
|
||||||
<th id="SUM_TO_STRING(Item.PrevValue)" class="sum">Prev. amount</th>
|
Prev. Operation</th>
|
||||||
<th id="Item.PrevValue.NextPos" class="num">Prev. History</th>
|
<th id="SUM_TO_STRING(Item.PrevValue)" class="sum">
|
||||||
|
Prev. amount</th>
|
||||||
|
<th id="Item.PrevValue.NextPos" class="num">Prev.
|
||||||
|
History</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="<< Prev">
|
||||||
@ -1922,7 +1961,7 @@
|
|||||||
|
|
||||||
<DIV id="idPaginationHash" style="display: none">
|
<DIV id="idPaginationHash" style="display: none">
|
||||||
<HR>
|
<HR>
|
||||||
<DIV id="view_header" >Accounts hash<BR></DIV>
|
<DIV id="view_header">Accounts hash<BR></DIV>
|
||||||
<INPUT type="button" onclick="ViewBegin(DefHash)" class="btdoitm bt" value="|<-">
|
<INPUT type="button" onclick="ViewBegin(DefHash)" class="btdoitm bt" value="|<-">
|
||||||
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="<< Prev">
|
||||||
<INPUT type="number" id="idViewHashNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefHash)">
|
<INPUT type="number" id="idViewHashNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefHash)">
|
||||||
@ -1932,14 +1971,22 @@
|
|||||||
<table id="grid_hash_all" class="grid">
|
<table id="grid_hash_all" class="grid">
|
||||||
<tr>
|
<tr>
|
||||||
<th id="Item.Num" class="num">Num</th>
|
<th id="Item.Num" class="num">Num</th>
|
||||||
<th id="(RetOpenBlock(Item.BlockNum,3))" class="">Block</th>
|
<th id="(RetOpenBlock(Item.BlockNum,3))"
|
||||||
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
|
class="">Block</th>
|
||||||
<th id="GetHexFromArr(Item.AccHash)" class="code">AccHash</th>
|
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
|
||||||
<th id="GetHexFromArr(Item.SumHash)" class="code">SumHash</th>
|
class="date">Date</th>
|
||||||
<th id="Item.AccountMax" class="num">AccountMax</th>
|
<th id="GetHexFromArr(Item.AccHash)"
|
||||||
<th id="Item.SmartCount" class="num">SmartCount</th>
|
class="code">AccHash</th>
|
||||||
<th id="GetHexFromArr(Item.SmartHash)" class="code">SmartHash</th>
|
<th id="GetHexFromArr(Item.SumHash)"
|
||||||
<th id="GetHexFromArr(Item.Hash100)" class="code">Hash100</th>
|
class="code">SumHash</th>
|
||||||
|
<th id="Item.AccountMax" class="num">
|
||||||
|
AccountMax</th>
|
||||||
|
<th id="Item.SmartCount" class="num">
|
||||||
|
SmartCount</th>
|
||||||
|
<th id="GetHexFromArr(Item.SmartHash)"
|
||||||
|
class="code">SmartHash</th>
|
||||||
|
<th id="GetHexFromArr(Item.Hash100)"
|
||||||
|
class="code">Hash100</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="<< Prev">
|
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="<< Prev">
|
||||||
@ -1948,9 +1995,10 @@
|
|||||||
|
|
||||||
<DIV id="idUtilView" style="display: none">
|
<DIV id="idUtilView" style="display: none">
|
||||||
<HR>
|
<HR>
|
||||||
<DIV id="view_header" >UTILITES<BR></DIV>
|
<DIV id="view_header">UTILITES<BR></DIV>
|
||||||
|
|
||||||
Number of blocks in depth:<INPUT type="number" id="idBlockCount" onchange = "SaveValues()" value="0"><BR>
|
Number of blocks in
|
||||||
|
depth:<INPUT type="number" id="idBlockCount" onchange = "SaveValues()" value="0"><BR>
|
||||||
<INPUT type="button" onclick="RestartNode()" class="bt btdoit btlong" value="Restart node">
|
<INPUT type="button" onclick="RestartNode()" class="bt btdoit btlong" value="Restart node">
|
||||||
<INPUT type="button" onclick="RewriteTransactions()" class="bt btdoit btlong" value="Rewrite transactions">
|
<INPUT type="button" onclick="RewriteTransactions()" class="bt btdoit btlong" value="Rewrite transactions">
|
||||||
<INPUT type="button" onclick="TruncateBlockChain()" class="btdoit btlong bt" value="Truncate chain">
|
<INPUT type="button" onclick="TruncateBlockChain()" class="btdoit btlong bt" value="Truncate chain">
|
||||||
@ -1984,17 +2032,29 @@
|
|||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
|
|
||||||
<FORM id="idBlockPasswordSet" style="display: none">
|
<FORM id="idBlockPasswordSet"
|
||||||
<H3 align="center">Enter new password:</H3>
|
style="display: none">
|
||||||
<table class="password" id="idTablePassword1">
|
<H3 align="center">Enter new password:
|
||||||
|
</H3>
|
||||||
|
<table class="password"
|
||||||
|
id="idTablePassword1">
|
||||||
<tr style="display: none">
|
<tr style="display: none">
|
||||||
<td><DIV>Login:</DIV></td><td><INPUT type="string" id="Login1" value=""></td>
|
<td>
|
||||||
|
<DIV>Login:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="string" id="Login1" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><DIV>Password:</DIV></td><td><INPUT type="password" autocomplete="WalletPassword" id="idPassword1" value=""></td>
|
<td>
|
||||||
|
<DIV>Password:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword1" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><DIV>Repeat:</DIV></td><td><INPUT type="password" autocomplete="WalletPassword" id="idPassword2" onkeyup="" value=""></td>
|
<td>
|
||||||
|
<DIV>Repeat:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword2" onkeyup="" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -2005,14 +2065,23 @@
|
|||||||
|
|
||||||
</table>
|
</table>
|
||||||
</FORM>
|
</FORM>
|
||||||
<FORM id="idBlockPasswordGet" style="display: none">
|
<FORM id="idBlockPasswordGet"
|
||||||
<H3 align="center">Enter your password:</H3>
|
style="display: none">
|
||||||
<table class="password" id="idTablePassword2">
|
<H3 align="center">Enter your password:
|
||||||
|
</H3>
|
||||||
|
<table class="password"
|
||||||
|
id="idTablePassword2">
|
||||||
<tr style="display: none">
|
<tr style="display: none">
|
||||||
<td><DIV>Login:</DIV></td><td><INPUT type="string" id="Login2" value=""></td>
|
<td>
|
||||||
|
<DIV>Login:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="string" id="Login2" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><DIV>Password:</DIV></td><td><INPUT type="password" autocomplete="WalletPassword" id="idPasswordGet" value=""></td>
|
<td>
|
||||||
|
<DIV>Password:</DIV>
|
||||||
|
</td>
|
||||||
|
<td><INPUT type="password" autocomplete="WalletPassword" id="idPasswordGet" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -2024,31 +2093,38 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<DIV id="idBlockOnSend" style="display: none">
|
<DIV id="idBlockOnSend"
|
||||||
|
style="display: none">
|
||||||
<DIV align="center">
|
<DIV align="center">
|
||||||
Send <B id="idOnSendText"></B><BR>
|
Send <B id="idOnSendText"></B><BR>
|
||||||
<button onclick="SendMoney2()" id="idBtOnSend" class="radius">Send</button>
|
<button onclick="SendMoney2()" id="idBtOnSend" class="radius">Send</button>
|
||||||
<button onclick='SetVisibleBlock("idBlockOnSend",0);' class="radius">Cancel</button>
|
<button onclick='SetVisibleBlock("idBlockOnSend",0);' class="radius">Cancel</button>
|
||||||
|
|
||||||
<DIV align="left">
|
<DIV align="left">
|
||||||
<DIV id="idCheckOnSend"><input type="checkbox" id="idWhiteOnSend"/> Add this account to white list</DIV>
|
<DIV id="idCheckOnSend">
|
||||||
|
<input type="checkbox" id="idWhiteOnSend"/> Add this account to white list</DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
|
|
||||||
<audio style="visibility: hidden;" controls="controls" id="sound_coin">
|
<audio style="visibility: hidden;"
|
||||||
<source src="coin.mp3" type="audio/mpeg"/>
|
controls="controls" id="sound_coin">
|
||||||
|
<source src="coin.mp3"
|
||||||
|
type="audio/mpeg" />
|
||||||
</audio>
|
</audio>
|
||||||
<audio style="visibility: hidden;" controls="controls" id="sound_err">
|
<audio style="visibility: hidden;"
|
||||||
<source src="click.mp3" type="audio/mpeg"/>
|
controls="controls" id="sound_err">
|
||||||
|
<source src="click.mp3"
|
||||||
|
type="audio/mpeg" />
|
||||||
</audio>
|
</audio>
|
||||||
|
|
||||||
|
|
||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
</DIV>
|
</DIV>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<DIV id="idStableScroll" align='center'>
|
<DIV id="idStableScroll" align='center'>
|
||||||
@ -2060,4 +2136,3 @@
|
|||||||
<A href="https://jq.qq.com/?_wv=1027&k=5KpN5fw">QQ</A>
|
<A href="https://jq.qq.com/?_wv=1027&k=5KpN5fw">QQ</A>
|
||||||
<!--progr76@gmail.com-->
|
<!--progr76@gmail.com-->
|
||||||
</DIV>
|
</DIV>
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ import * as crypto from 'crypto';
|
|||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
|
|
||||||
global.glStopNode = false;
|
global.glStopNode = false;
|
||||||
//const MAX_TIME_NETWORK_TRANSPORT = 1 * 1000;
|
const MAX_TIME_NETWORK_TRANSPORT = 1 * 1000;
|
||||||
var GlSumUser;
|
var GlSumUser;
|
||||||
var GlSumSys;
|
var GlSumSys;
|
||||||
var GlSumIdle;
|
var GlSumIdle;
|
||||||
global.CountAllNode = 0;
|
global.CountAllNode = 0;
|
||||||
module.exports = class CCommon {
|
export default class CCommon {
|
||||||
VirtualMode
|
VirtualMode
|
||||||
KeyPair
|
KeyPair
|
||||||
PubKeyType
|
PubKeyType
|
||||||
@ -34,8 +34,6 @@ module.exports = class CCommon {
|
|||||||
CheckName
|
CheckName
|
||||||
NodesArr
|
NodesArr
|
||||||
CurrentBlockNum
|
CurrentBlockNum
|
||||||
ReadBlockHeaderDB
|
|
||||||
GetActualNodes
|
|
||||||
BlockNumDB
|
BlockNumDB
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
global.SERVER = this
|
global.SERVER = this
|
||||||
@ -48,6 +46,18 @@ module.exports = class CCommon {
|
|||||||
this.HashDBArr = global.shaarr2(this.KeyPair.getPrivateKey(), [0, 0, 0, 0, 0, 0, 0, 1])
|
this.HashDBArr = global.shaarr2(this.KeyPair.getPrivateKey(), [0, 0, 0, 0, 0, 0, 0, 1])
|
||||||
this.ServerSign = []
|
this.ServerSign = []
|
||||||
}
|
}
|
||||||
|
SendF(Node, Info, Length?) {
|
||||||
|
// defiend in server.ts
|
||||||
|
}
|
||||||
|
AddCheckErrCount(Node, Count, StrErr) {
|
||||||
|
// defiend in server.ts
|
||||||
|
}
|
||||||
|
GetActualNodes(): any {
|
||||||
|
// defiend in server.ts
|
||||||
|
}
|
||||||
|
ReadBlockHeaderDB(BlockNum): any {
|
||||||
|
// defiend in block-db.ts(CDB)
|
||||||
|
}
|
||||||
AddStatOnTimer() {
|
AddStatOnTimer() {
|
||||||
var CountAll = 0;
|
var CountAll = 0;
|
||||||
var CurTime = global.GetCurrentTime() - 0;
|
var CurTime = global.GetCurrentTime() - 0;
|
||||||
@ -204,7 +214,7 @@ module.exports = class CCommon {
|
|||||||
return crypto.randomBytes(32);
|
return crypto.randomBytes(32);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export class SMemBuffer {
|
class SMemBuffer {
|
||||||
MetaMap1
|
MetaMap1
|
||||||
MetaMap2
|
MetaMap2
|
||||||
CheckName
|
CheckName
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import CBlock from './block-loader'
|
||||||
require('./library');
|
require('./library');
|
||||||
require('./crypto-library');
|
require('./crypto-library');
|
||||||
const TX_PROCESS_TIME = 100;
|
const TX_PROCESS_TIME = 100;
|
||||||
@ -38,14 +39,14 @@ var FORMAT_DATA_TRANSFER = "{\
|
|||||||
NoSendTx:uint,\
|
NoSendTx:uint,\
|
||||||
}";
|
}";
|
||||||
const WorkStructSend = {};
|
const WorkStructSend = {};
|
||||||
module.exports = class CConsensus extends require("./block-loader")
|
export default class CConsensus extends CBlock {
|
||||||
{
|
|
||||||
CurrentBlockNum
|
CurrentBlockNum
|
||||||
SendBlockID
|
SendBlockID
|
||||||
RelayMode
|
RelayMode
|
||||||
TreeSendPacket
|
TreeSendPacket
|
||||||
idBlockChainTimer
|
idBlockChainTimer
|
||||||
OwnBlockCount
|
OwnBlockCount
|
||||||
|
LevelNodes
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
this.CurrentBlockNum = 0
|
this.CurrentBlockNum = 0
|
||||||
@ -175,9 +176,9 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
}
|
}
|
||||||
Transfer.WasGet = true
|
Transfer.WasGet = true
|
||||||
if (global.DoTxLog && Data.TicketArray.length)
|
if (global.DoTxLog && Data.TicketArray.length)
|
||||||
global.ToLog("TRANSFER BlockNum:" + Block.BlockNum + " TicketArray=" + Data.TicketArray.length + " from " + NodeName(Node))
|
global.ToLog("TRANSFER BlockNum:" + Block.BlockNum + " TicketArray=" + Data.TicketArray.length + " from " + global.NodeName(Node))
|
||||||
if (global.DoTxLog && Data.TxArray.length)
|
if (global.DoTxLog && Data.TxArray.length)
|
||||||
global.ToLog("TRANSFER BlockNum:" + Block.BlockNum + " TxArray=" + Data.TxArray.length + " from " + NodeName(Node))
|
global.ToLog("TRANSFER BlockNum:" + Block.BlockNum + " TxArray=" + Data.TxArray.length + " from " + global.NodeName(Node))
|
||||||
this.ToMaxPOWList(Data.MaxPOW)
|
this.ToMaxPOWList(Data.MaxPOW)
|
||||||
this.ToMaxSumList(this.GetMaxSumListFromID(Node, Data.MaxSumID, Data.BlockList))
|
this.ToMaxSumList(this.GetMaxSumListFromID(Node, Data.MaxSumID, Data.BlockList))
|
||||||
//var WasNewAdd = 0;
|
//var WasNewAdd = 0;
|
||||||
@ -343,7 +344,7 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
Arr = Arr2
|
Arr = Arr2
|
||||||
}
|
}
|
||||||
if (global.DoTxLog)
|
if (global.DoTxLog)
|
||||||
global.ToLog("SEND TRANSFER BlockNum:" + Block.BlockNum + " Arr=" + Arr.length + " to " + NodeName(Item.Node))
|
global.ToLog("SEND TRANSFER BlockNum:" + Block.BlockNum + " Arr=" + Arr.length + " to " + global.NodeName(Item.Node))
|
||||||
var BufData = this.CreateTransferBuffer(Arr, arrPow, arrSum, Block, Item.Node);
|
var BufData = this.CreateTransferBuffer(Arr, arrPow, arrSum, Block, Item.Node);
|
||||||
this.Send(Item.Node, { "Method": "TRANSFER", "Context": {}, "Data": BufData }, 1)
|
this.Send(Item.Node, { "Method": "TRANSFER", "Context": {}, "Data": BufData }, 1)
|
||||||
if (!Block.JobListTX)
|
if (!Block.JobListTX)
|
||||||
@ -351,6 +352,9 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
Block.JobListTX.push({ Node: Item.Node, TreeLevel: Item.TreeLevel, Time: Date.now() })
|
Block.JobListTX.push({ Node: Item.Node, TreeLevel: Item.TreeLevel, Time: Date.now() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Send(Node, Info, TypeData?) {
|
||||||
|
// defiend in server.ts
|
||||||
|
}
|
||||||
TRANSFERTX(Info, CurTime) {
|
TRANSFERTX(Info, CurTime) {
|
||||||
var Data = this.DataFromF(Info);
|
var Data = this.DataFromF(Info);
|
||||||
var Node = Info.Node;
|
var Node = Info.Node;
|
||||||
@ -359,7 +363,7 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (global.DoTxLog)
|
if (global.DoTxLog)
|
||||||
global.ToLog("TRANSFERTX BlockNum:" + Block.BlockNum + " Array=" + Data.Array.length + " from " + NodeName(Node))
|
global.ToLog("TRANSFERTX BlockNum:" + Block.BlockNum + " Array=" + Data.Array.length + " from " + global.NodeName(Node))
|
||||||
for (var i = 0; i < Data.Array.length; i++) {
|
for (var i = 0; i < Data.Array.length; i++) {
|
||||||
this.AddTrToBlockQuote(Block, Data.Array[i], 1)
|
this.AddTrToBlockQuote(Block, Data.Array[i], 1)
|
||||||
}
|
}
|
||||||
@ -434,7 +438,7 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (global.DoTxLog)
|
if (global.DoTxLog)
|
||||||
global.ToLog("RETTRANSFERTX BlockNum:" + Block.BlockNum + " Array=" + Data.Array.length + " from " + NodeName(Node))
|
global.ToLog("RETTRANSFERTX BlockNum:" + Block.BlockNum + " Array=" + Data.Array.length + " from " + global.NodeName(Node))
|
||||||
for (var i = 0; i < Data.Array.length; i++) {
|
for (var i = 0; i < Data.Array.length; i++) {
|
||||||
var Tr = Data.Array[i];
|
var Tr = Data.Array[i];
|
||||||
this.CheckCreateTransactionObject(Tr)
|
this.CheckCreateTransactionObject(Tr)
|
||||||
@ -464,7 +468,7 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
if (!Arr.length)
|
if (!Arr.length)
|
||||||
return;
|
return;
|
||||||
if (global.DoTxLog)
|
if (global.DoTxLog)
|
||||||
global.ToLog("DoJobListTX BlockNum:" + Block.BlockNum + " Arr=" + Arr.length + " to " + NodeName(JobItem.Node))
|
global.ToLog("DoJobListTX BlockNum:" + Block.BlockNum + " Arr=" + Arr.length + " to " + global.NodeName(JobItem.Node))
|
||||||
var SendData = { "Method": "TRANSFERTX", "Context": {}, "Data": { BlockNum: Block.BlockNum, Array: Arr, } };
|
var SendData = { "Method": "TRANSFERTX", "Context": {}, "Data": { BlockNum: Block.BlockNum, Array: Arr, } };
|
||||||
this.SendF(JobItem.Node, SendData, global.MAX_BLOCK_SIZE + 1000)
|
this.SendF(JobItem.Node, SendData, global.MAX_BLOCK_SIZE + 1000)
|
||||||
}
|
}
|
||||||
@ -570,7 +574,7 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
for (var n = 0; n < ArrNodesArr.length; n++) {
|
for (var n = 0; n < ArrNodesArr.length; n++) {
|
||||||
var ElArr = ArrNodesArr[n];
|
var ElArr = ArrNodesArr[n];
|
||||||
if (global.DoTxLog)
|
if (global.DoTxLog)
|
||||||
global.ToLog("CheckTxExchange BlockNum:" + Block.BlockNum + " Array=" + ElArr.Arr.length + " to " + NodeName(ElArr.Node))
|
global.ToLog("CheckTxExchange BlockNum:" + Block.BlockNum + " Array=" + ElArr.Arr.length + " to " + global.NodeName(ElArr.Node))
|
||||||
var SendData = { "Method": "GETTRANSFERTX", "Context": {}, "Data": { BlockNum: Block.BlockNum, TicketArray: ElArr.Arr, } };
|
var SendData = { "Method": "GETTRANSFERTX", "Context": {}, "Data": { BlockNum: Block.BlockNum, TicketArray: ElArr.Arr, } };
|
||||||
this.SendF(ElArr.Node, SendData, ElArr.Arr.length * global.TR_TICKET_HASH_LENGTH + 1000)
|
this.SendF(ElArr.Node, SendData, ElArr.Arr.length * global.TR_TICKET_HASH_LENGTH + 1000)
|
||||||
}
|
}
|
||||||
@ -865,7 +869,25 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
CheckPrioritetTx(Tr) {
|
||||||
|
if (Tr.Prioritet === undefined) {
|
||||||
|
var Body = Tr.body;
|
||||||
|
Tr.Prioritet = global.MAX_LENGTH_SENDER_MAP
|
||||||
|
var App = global.DAppByType[Body[0]];
|
||||||
|
if (App) {
|
||||||
|
Tr.SenderNum = App.GetSenderNum(Tr.num, Body)
|
||||||
|
if (Tr.SenderNum && Tr.SenderNum > 0) {
|
||||||
|
Tr.Prioritet = this.GetSenderPrioritet(Tr.num, Tr.SenderNum)
|
||||||
|
Tr.TimePow = Tr.Prioritet + Tr.power
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GetSenderPrioritet(BlockNum, SenderNum) {
|
||||||
|
//defiend in transaction-validator.ts(CSmartContract)
|
||||||
|
}
|
||||||
AddToQuote(Tree, Tr) {
|
AddToQuote(Tree, Tr) {
|
||||||
|
this.CheckPrioritetTx(Tr)
|
||||||
var Tr0 = Tree.find(Tr);
|
var Tr0 = Tree.find(Tr);
|
||||||
if (Tr0) {
|
if (Tr0) {
|
||||||
return 3;
|
return 3;
|
||||||
@ -881,6 +903,15 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IsValidTicket(Tr, BlockNum): any {
|
||||||
|
// defiend in transaction-validator.ts(CSmartContract)
|
||||||
|
}
|
||||||
|
IsValidTransaction(Tr, BlockNum): any {
|
||||||
|
// defiend in transaction-validator.ts(CSmartContract)
|
||||||
|
}
|
||||||
|
AddDAppTransactions(BlockNum, Arr) {
|
||||||
|
// defiend in transaction-validator.ts(CSmartContract)
|
||||||
|
}
|
||||||
AddTicketToBlockQuote(Block, Tr) {
|
AddTicketToBlockQuote(Block, Tr) {
|
||||||
if (Block.PowTicketTree) {
|
if (Block.PowTicketTree) {
|
||||||
var Res = this.IsValidTicket(Tr, Block.BlockNum);
|
var Res = this.IsValidTicket(Tr, Block.BlockNum);
|
||||||
@ -1267,14 +1298,14 @@ module.exports = class CConsensus extends require("./block-loader")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var MaxNumBlockDB = this.GetMaxNumBlockDB();
|
var MaxNumBlockDB = this.GetMaxNumBlockDB();
|
||||||
if (CURRENTBLOCKNUM + global.BLOCK_PROCESSING_LENGTH2 > MaxNumBlockDB)
|
if (CURRENTBLOCKNUM + global.BLOCK_PROCESSING_LENGTH2 > MaxNumBlockDB && CURRENTBLOCKNUM - global.BLOCK_PROCESSING_LENGTH2 < MaxNumBlockDB)
|
||||||
for (var BlockNum = CURRENTBLOCKNUM - global.BLOCK_PROCESSING_LENGTH2; BlockNum > global.BLOCK_PROCESSING_LENGTH2 && BlockNum < start_save; BlockNum++) {
|
for (var BlockNum = CURRENTBLOCKNUM - global.BLOCK_PROCESSING_LENGTH2; BlockNum > global.BLOCK_PROCESSING_LENGTH2 && BlockNum < start_save; BlockNum++) {
|
||||||
var Block = this.GetBlock(BlockNum);
|
var Block = this.GetBlock(BlockNum);
|
||||||
if (Block && !Block.bSave && Block.TrCount && Block.TreeHash && !global.IsZeroArr(Block.TreeHash) && !Block.WasSaveDataTree) {
|
if (Block && !Block.bSave && Block.TrCount && Block.TreeHash && !global.IsZeroArr(Block.TreeHash) && !Block.WasSaveDataTree) {
|
||||||
this.PreSaveDataTreeToDB(Block)
|
this.PreSaveDataTreeToDB(Block)
|
||||||
Block.WasSaveDataTree = 1
|
Block.WasSaveDataTree = 1
|
||||||
global.AddInfoBlock(Block, "*PRESAVE DATA TREE*")
|
global.AddInfoBlock(Block, "*PRESAVE DATA TREE*")
|
||||||
global.ToLog("PRESAVE DATA: " + Block.BlockNum)
|
global.ToLog("PRESAVE DATA: " + Block.BlockNum, 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.RelayMode = !bWasSave
|
this.RelayMode = !bWasSave
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
//const fs = require("fs");
|
import * as fs from 'fs'
|
||||||
|
import CRest from './rest-loader'
|
||||||
//import * as crypto from 'crypto';
|
//import * as crypto from 'crypto';
|
||||||
require('./block-loader-const');
|
require('./block-loader-const');
|
||||||
const STAT_BLOCK_LOAD_PERIOD = global.CONSENSUS_PERIOD_TIME / 5;
|
const STAT_BLOCK_LOAD_PERIOD = global.CONSENSUS_PERIOD_TIME / 5;
|
||||||
module.exports = class CBlock extends require("./rest-loader")
|
export default class CBlock extends CRest {
|
||||||
{
|
|
||||||
MapMapLoaded
|
MapMapLoaded
|
||||||
BlockChain
|
BlockChain
|
||||||
ChainID
|
ChainID
|
||||||
@ -32,6 +32,7 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
LoadHistoryContext
|
LoadHistoryContext
|
||||||
LoadBlockStatNum
|
LoadBlockStatNum
|
||||||
BADHashCount
|
BADHashCount
|
||||||
|
ActualNodes
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
this.MapMapLoaded = {}
|
this.MapMapLoaded = {}
|
||||||
@ -594,7 +595,7 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
}
|
}
|
||||||
if (chain.LoadCountDB >= global.COUNT_BLOCKS_FOR_CHECK_POW) {
|
if (chain.LoadCountDB >= global.COUNT_BLOCKS_FOR_CHECK_POW) {
|
||||||
if (chain.LoadSumDB - chain.LoadSum > global.MAX_DELTA_COUNT_SUM_FOR_LOAD) {
|
if (chain.LoadSumDB - chain.LoadSum > global.MAX_DELTA_COUNT_SUM_FOR_LOAD) {
|
||||||
var Str = "ERR LOADED SUM POW chains: SumDB > Sum loaded from: " + NodeInfo(Info.Node);
|
var Str = "ERR LOADED SUM POW chains: SumDB > Sum loaded from: " + global.NodeInfo(Info.Node);
|
||||||
chain.StopSend = true
|
chain.StopSend = true
|
||||||
chain.AddInfo(Str)
|
chain.AddInfo(Str)
|
||||||
}
|
}
|
||||||
@ -764,7 +765,7 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var Res = 0;
|
var Res: any = 0;
|
||||||
if (Block.TreeEq) {
|
if (Block.TreeEq) {
|
||||||
this.ReadBlockBodyDB(Block)
|
this.ReadBlockBodyDB(Block)
|
||||||
Res = this.WriteBlockDBFinaly(Block)
|
Res = this.WriteBlockDBFinaly(Block)
|
||||||
@ -804,6 +805,9 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
this.FREE_ALL_MEM_CHAINS()
|
this.FREE_ALL_MEM_CHAINS()
|
||||||
global.ADD_TO_STAT_TIME("WRITECHAIN_TO_DB_TIME", startTime)
|
global.ADD_TO_STAT_TIME("WRITECHAIN_TO_DB_TIME", startTime)
|
||||||
}
|
}
|
||||||
|
SetNoPOW(BlockNumFrom, bReload, RefBlockNum) {
|
||||||
|
//defiend in block-exchange.js
|
||||||
|
}
|
||||||
CopyBlock(Block, BlockDst) {
|
CopyBlock(Block, BlockDst) {
|
||||||
BlockDst.BlockNum = Block.BlockNum
|
BlockDst.BlockNum = Block.BlockNum
|
||||||
BlockDst.TreeHash = Block.TreeHash
|
BlockDst.TreeHash = Block.TreeHash
|
||||||
@ -830,6 +834,9 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
}
|
}
|
||||||
this.AddToStatBlockConfirmation(Block)
|
this.AddToStatBlockConfirmation(Block)
|
||||||
}
|
}
|
||||||
|
RecreateMaxPOW(Block) {
|
||||||
|
//defiend in block-exchange.js
|
||||||
|
}
|
||||||
ClearMaxInBlock(Block) {
|
ClearMaxInBlock(Block) {
|
||||||
Block.MaxPOW = {}
|
Block.MaxPOW = {}
|
||||||
var POW = Block.MaxPOW;
|
var POW = Block.MaxPOW;
|
||||||
@ -947,7 +954,7 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
FreeGet -= Node.CanGetBlocks
|
FreeGet -= Node.CanGetBlocks
|
||||||
Node.SendBlockCount = 0
|
Node.SendBlockCount = 0
|
||||||
Node.LoadBlockCount = 0
|
Node.LoadBlockCount = 0
|
||||||
global.ADD_TO_STAT("NODE_CAN_GET:" + NodeName(Node), Node.CanGetBlocks, 1)
|
global.ADD_TO_STAT("NODE_CAN_GET:" + global.NodeName(Node), Node.CanGetBlocks, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static
|
static
|
||||||
@ -974,7 +981,7 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
var arrContent = Data.arrContent;
|
var arrContent = Data.arrContent;
|
||||||
var TreeHash = global.CalcTreeHashFromArrBody(Block.BlockNum, arrContent);
|
var TreeHash = global.CalcTreeHashFromArrBody(Block.BlockNum, arrContent);
|
||||||
if (global.CompareArr(Block.TreeHash, TreeHash) !== 0) {
|
if (global.CompareArr(Block.TreeHash, TreeHash) !== 0) {
|
||||||
global.ToLog("2. BAD CMP TreeHash block=" + Block.BlockNum + " from:" + NodeName(Info.Node) + " TreeHash=" + global.GetHexFromArr(TreeHash) + " BlockTreeHash=" + global.GetHexFromArr(Block.TreeHash))
|
global.ToLog("2. BAD CMP TreeHash block=" + Block.BlockNum + " from:" + global.NodeName(Info.Node) + " TreeHash=" + global.GetHexFromArr(TreeHash) + " BlockTreeHash=" + global.GetHexFromArr(Block.TreeHash))
|
||||||
this.SetBlockNOSendToNode(Block, Info.Node, "BAD CMP TreeHash")
|
this.SetBlockNOSendToNode(Block, Info.Node, "BAD CMP TreeHash")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -982,10 +989,11 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
var TR = arrContent[0];
|
var TR = arrContent[0];
|
||||||
if (TR[0] === global.TYPE_TRANSACTION_ACC_HASH) {
|
if (TR[0] === global.TYPE_TRANSACTION_ACC_HASH) {
|
||||||
if (!global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum)) {
|
if (!global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum)) {
|
||||||
|
global.ToLog(`global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum) ${JSON.stringify(TR)}, ${Data.BlockNum}`)
|
||||||
if (!this.BADHashCount)
|
if (!this.BADHashCount)
|
||||||
this.BADHashCount = 0
|
this.BADHashCount = 0
|
||||||
this.BADHashCount++
|
this.BADHashCount++
|
||||||
global.ToLog("**** BAD ACCOUNT Hash in block=" + Block.BlockNum + " from:" + NodeName(Info.Node) + " ****")
|
global.ToLog("**** BAD ACCOUNT Hash in block=" + Block.BlockNum + " from:" + global.NodeName(Info.Node) + " ****")
|
||||||
global.ToLog("May be need to Rewrite transactions from: " + (Block.BlockNum - 2 * global.DELTA_BLOCK_ACCOUNT_HASH))
|
global.ToLog("May be need to Rewrite transactions from: " + (Block.BlockNum - 2 * global.DELTA_BLOCK_ACCOUNT_HASH))
|
||||||
this.SetBlockNOSendToNode(Block, Info.Node, "BAD CMP ACC HASH")
|
this.SetBlockNOSendToNode(Block, Info.Node, "BAD CMP ACC HASH")
|
||||||
if (global.WATCHDOG_BADACCOUNT && this.BADHashCount > 60) {
|
if (global.WATCHDOG_BADACCOUNT && this.BADHashCount > 60) {
|
||||||
@ -1046,6 +1054,9 @@ module.exports = class CBlock extends require("./rest-loader")
|
|||||||
Info.Node.LoadBlockCount++
|
Info.Node.LoadBlockCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DataFromF(Info, bSendFormat?): any {
|
||||||
|
//defiend in server.js
|
||||||
|
}
|
||||||
SetBlockNOSendToNode(Block, Node, Str) {
|
SetBlockNOSendToNode(Block, Node, Str) {
|
||||||
var Str = global.GetHexFromArr(Block.TreeHash);
|
var Str = global.GetHexFromArr(Block.TreeHash);
|
||||||
var Str2 = this.GetStrFromHashShort(Block.TreeHash);
|
var Str2 = this.GetStrFromHashShort(Block.TreeHash);
|
||||||
@ -1276,11 +1287,11 @@ global.LoadBlockFromNetwork = function(Params, F) {
|
|||||||
var Block = global.BufLib.GetObjectFromBuffer(Info.Data, global.FORMAT_BLOCK_TRANSFER, global.WRK_BLOCK_TRANSFER);
|
var Block = global.BufLib.GetObjectFromBuffer(Info.Data, global.FORMAT_BLOCK_TRANSFER, global.WRK_BLOCK_TRANSFER);
|
||||||
Info.Data = undefined;
|
Info.Data = undefined;
|
||||||
if (!Block.BlockNum || Block.BlockNum !== Params.BlockNum) {
|
if (!Block.BlockNum || Block.BlockNum !== Params.BlockNum) {
|
||||||
global.ToLog("Error get BlockNum:" + Params.BlockNum + " from " + NodeName(Info.Node), 2);
|
global.ToLog("Error get BlockNum:" + Params.BlockNum + " from " + global.NodeName(Info.Node), 2);
|
||||||
F(1);
|
F(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
global.ToLog("Got BlockFromNetwork:" + Params.BlockNum + " from " + NodeName(Info.Node), 2);
|
global.ToLog("Got BlockFromNetwork:" + Params.BlockNum + " from " + global.NodeName(Info.Node), 2);
|
||||||
var ResError;
|
var ResError;
|
||||||
if (!Block.arrContent || Block.arrContent.length === 0) {
|
if (!Block.arrContent || Block.arrContent.length === 0) {
|
||||||
ResError = 1;
|
ResError = 1;
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import CCommon from './base'
|
||||||
// const FORMAT_EVAL_SEND = "{MaxBlockNum:uint,Code:str,Sign:arr64}";
|
// const FORMAT_EVAL_SEND = "{MaxBlockNum:uint,Code:str,Sign:arr64}";
|
||||||
module.exports = class CCode extends require("./base")
|
export default class CCode extends CCommon {
|
||||||
{
|
|
||||||
LastEvalCodeNum
|
LastEvalCodeNum
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
// import * as crypto from 'crypto';
|
// import * as crypto from 'crypto';
|
||||||
const CNode = require("./node");
|
import CNode from './node'
|
||||||
|
import CMessages from './transfer-msg'
|
||||||
global.PERIOD_FOR_RECONNECT = 3600 * 1000;
|
global.PERIOD_FOR_RECONNECT = 3600 * 1000;
|
||||||
global.CHECK_DELTA_TIME = { Num: 0, bUse: 0, StartBlockNum: 0, EndBlockNum: 0, bAddTime: 0, DeltaTime: 0, Sign: [] };
|
global.CHECK_DELTA_TIME = { Num: 0, bUse: 0, StartBlockNum: 0, EndBlockNum: 0, bAddTime: 0, DeltaTime: 0, Sign: [] };
|
||||||
global.CHECK_POINT = { BlockNum: 0, Hash: [], Sign: [] };
|
global.CHECK_POINT = { BlockNum: 0, Hash: [], Sign: [] };
|
||||||
@ -30,8 +31,9 @@ global.MAX_PING_FOR_CONNECT = 400;
|
|||||||
var MAX_TIME_CORRECT = 3 * 3600 * 1000;
|
var MAX_TIME_CORRECT = 3 * 3600 * 1000;
|
||||||
global.MAX_WAIT_PERIOD_FOR_HOT = 4 * global.CONSENSUS_PERIOD_TIME;
|
global.MAX_WAIT_PERIOD_FOR_HOT = 4 * global.CONSENSUS_PERIOD_TIME;
|
||||||
const PERIOD_FOR_START_CHECK_TIME = 300;
|
const PERIOD_FOR_START_CHECK_TIME = 300;
|
||||||
module.exports = class CConnect extends require("./transfer-msg")
|
export default class CConnect extends CMessages {
|
||||||
{
|
ip
|
||||||
|
port
|
||||||
StartTime
|
StartTime
|
||||||
WasNodesSort
|
WasNodesSort
|
||||||
LevelNodes
|
LevelNodes
|
||||||
@ -50,6 +52,9 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
StopDetectGrayMode
|
StopDetectGrayMode
|
||||||
LastNotZeroNodesTime
|
LastNotZeroNodesTime
|
||||||
TransferTree
|
TransferTree
|
||||||
|
СтатБлок
|
||||||
|
BusyLevel
|
||||||
|
SendTrafficFree
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
this.StartTime = Date.now()
|
this.StartTime = Date.now()
|
||||||
@ -103,7 +108,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
StartConnectTry(Node) {
|
StartConnectTry(Node) {
|
||||||
var Delta = Date.now() - Node.StartTimeConnect;
|
var Delta = Date.now() - Node.StartTimeConnect;
|
||||||
if (Delta >= Node.NextConnectDelta && this.IsCanConnect(Node)) {
|
if (Delta >= Node.NextConnectDelta && this.IsCanConnect(Node)) {
|
||||||
if (!GetSocketStatus(Node.Socket)) {
|
if (!global.GetSocketStatus(Node.Socket)) {
|
||||||
Node.StartTimeConnect = Date.now()
|
Node.StartTimeConnect = Date.now()
|
||||||
if (Delta < 60 * 1000)
|
if (Delta < 60 * 1000)
|
||||||
Node.NextConnectDelta = Node.NextConnectDelta * 2
|
Node.NextConnectDelta = Node.NextConnectDelta * 2
|
||||||
@ -312,7 +317,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
this.CheckCodeVersion(Data, Info.Node)
|
this.CheckCodeVersion(Data, Info.Node)
|
||||||
if (!global.CAN_START) {
|
if (!global.CAN_START) {
|
||||||
if (DeltaTime > global.MAX_PING_FOR_CONNECT)
|
if (DeltaTime > global.MAX_PING_FOR_CONNECT)
|
||||||
global.ToLog("DeltaTime=" + DeltaTime + ">" + global.MAX_PING_FOR_CONNECT + " ms - " + NodeInfo(Node), 2)
|
global.ToLog("DeltaTime=" + DeltaTime + ">" + global.MAX_PING_FOR_CONNECT + " ms - " + global.NodeInfo(Node), 2)
|
||||||
}
|
}
|
||||||
var Times;
|
var Times;
|
||||||
if (DeltaTime <= global.MAX_PING_FOR_CONNECT) {
|
if (DeltaTime <= global.MAX_PING_FOR_CONNECT) {
|
||||||
@ -367,7 +372,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Node.NextConnectDelta = 60 * 1000
|
Node.NextConnectDelta = 60 * 1000
|
||||||
global.ToLog("Error Sign CheckPoint=" + Data.CheckPoint.BlockNum + " from " + NodeInfo(Node))
|
global.ToLog("Error Sign CheckPoint=" + Data.CheckPoint.BlockNum + " from " + global.NodeInfo(Node))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign CheckPoint")
|
this.AddCheckErrCount(Node, 10, "Error Sign CheckPoint")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,7 +387,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Node.NextConnectDelta = 60 * 1000
|
Node.NextConnectDelta = 60 * 1000
|
||||||
global.ToLog("Error Sign CheckDeltaTime Num=" + Data.CheckDeltaTime.Num + " from " + NodeInfo(Node))
|
global.ToLog("Error Sign CheckDeltaTime Num=" + Data.CheckDeltaTime.Num + " from " + global.NodeInfo(Node))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign CheckDeltaTime")
|
this.AddCheckErrCount(Node, 10, "Error Sign CheckDeltaTime")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,7 +414,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Node.NextConnectDelta = 60 * 1000
|
Node.NextConnectDelta = 60 * 1000
|
||||||
global.ToLog("Error Sign CheckNetConstant Num=" + Data.NetConstant.Num + " from " + NodeInfo(Node))
|
global.ToLog("Error Sign CheckNetConstant Num=" + Data.NetConstant.Num + " from " + global.NodeInfo(Node))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign CheckNetConstant")
|
this.AddCheckErrCount(Node, 10, "Error Sign CheckNetConstant")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,7 +467,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
global.ToLog("Error Sign CodeVersion=" + CodeVersion.VersionNum + " from " + NodeInfo(Node) + " HASH:" + global.GetHexFromArr(CodeVersion.Hash).substr(0,
|
global.ToLog("Error Sign CodeVersion=" + CodeVersion.VersionNum + " from " + global.NodeInfo(Node) + " HASH:" + global.GetHexFromArr(CodeVersion.Hash).substr(0,
|
||||||
20))
|
20))
|
||||||
global.ToLog(JSON.stringify(CodeVersion))
|
global.ToLog(JSON.stringify(CodeVersion))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign CodeVersion")
|
this.AddCheckErrCount(Node, 10, "Error Sign CodeVersion")
|
||||||
@ -592,6 +597,9 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
NodeInBan(Node) {
|
||||||
|
//defiend in
|
||||||
|
}
|
||||||
GetDirectNodesArray(bAll, bWebPort?, bGetAddrArr?) {
|
GetDirectNodesArray(bAll, bWebPort?, bGetAddrArr?) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
var Value: any = {
|
var Value: any = {
|
||||||
@ -802,6 +810,9 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
Info.Node.LevelCount = Data.Count
|
Info.Node.LevelCount = Data.Count
|
||||||
}
|
}
|
||||||
|
AddCheckErrCount(Node, Count, StrErr?) {
|
||||||
|
//defiend in server.ts
|
||||||
|
}
|
||||||
DeleteBadConnectingByTimer() {
|
DeleteBadConnectingByTimer() {
|
||||||
if (global.glStopNode)
|
if (global.glStopNode)
|
||||||
return;
|
return;
|
||||||
@ -809,7 +820,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
var arr = global.SERVER.NodesArr;
|
var arr = global.SERVER.NodesArr;
|
||||||
for (var i = 0; i < arr.length; i++) {
|
for (var i = 0; i < arr.length; i++) {
|
||||||
var Node = arr[i];
|
var Node = arr[i];
|
||||||
var Status = GetSocketStatus(Node.Socket);
|
var Status = global.GetSocketStatus(Node.Socket);
|
||||||
if (Node.Active && Status < 100) {
|
if (Node.Active && Status < 100) {
|
||||||
var Delta = CurTime - Node.LastTime;
|
var Delta = CurTime - Node.LastTime;
|
||||||
if (Delta > global.MAX_WAIT_PERIOD_FOR_STATUS) {
|
if (Delta > global.MAX_WAIT_PERIOD_FOR_STATUS) {
|
||||||
@ -882,7 +893,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
this.SignCurrentTimeDev = global.GetArrFromValue(global.SHA3BUF(SignArr), global.WALLET.KeyPair.getPrivateKey('')).signature
|
this.SignCurrentTimeDev = global.GetArrFromValue(global.SHA3BUF(SignArr), global.WALLET.KeyPair.getPrivateKey('')).signature
|
||||||
}
|
}
|
||||||
var Time = global.GetCurrentTime() - 0;
|
var Time = global.GetCurrentTime() - 0;
|
||||||
global.ToLog("Send time: " + Time + " to " + NodeInfo(Node))
|
global.ToLog("Send time: " + Time + " to " + global.NodeInfo(Node))
|
||||||
this.SendF(Node, { "Method": "TIME", "Data": { Time: Time, Sign: this.SignCurrentTimeDev } })
|
this.SendF(Node, { "Method": "TIME", "Data": { Time: Time, Sign: this.SignCurrentTimeDev } })
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -907,7 +918,7 @@ module.exports = class CConnect extends require("./transfer-msg")
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Node.NextConnectDelta = 60 * 1000
|
Node.NextConnectDelta = 60 * 1000
|
||||||
global.ToLog("Error Sign TIME from " + NodeInfo(Node))
|
global.ToLog("Error Sign TIME from " + global.NodeInfo(Node))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign TIME")
|
this.AddCheckErrCount(Node, 10, "Error Sign TIME")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
global.UPDATE_CODE_VERSION_NUM = 1127;
|
global.UPDATE_CODE_VERSION_NUM = 1127;
|
||||||
global.MIN_CODE_VERSION_NUM = 1094;
|
global.MIN_CODE_VERSION_NUM = 1114;
|
||||||
global.MINING_VERSION_NUM = 0;
|
global.MINING_VERSION_NUM = 0;
|
||||||
global.InitParamsArg = InitParamsArg;
|
global.InitParamsArg = InitParamsArg;
|
||||||
global.CONST_NAME_ARR = [
|
global.CONST_NAME_ARR = [
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
const DBLib = require("./db");
|
import Db from './db'
|
||||||
const DBRow = require("./db-row");
|
import DBRow from './db-row'
|
||||||
global.BlockDB = new DBLib();
|
import CCode from '../code'
|
||||||
|
global.BlockDB = new Db();
|
||||||
global.BLOCK_HEADER_SIZE = 150;
|
global.BLOCK_HEADER_SIZE = 150;
|
||||||
const FILE_NAME_HEADER = "block-header";
|
const FILE_NAME_HEADER = "block-header";
|
||||||
const FILE_NAME_BODY = "block-body";
|
const FILE_NAME_BODY = "block-body";
|
||||||
@ -33,8 +34,7 @@ const FORMAT_HEADER_VERSION2 = "{FilePos:uint}";
|
|||||||
const FILE_NAME_HEADER2 = "block-header2";
|
const FILE_NAME_HEADER2 = "block-header2";
|
||||||
const WorkStructHeader2 = {};
|
const WorkStructHeader2 = {};
|
||||||
const DEFAULT_DB_VERSION = 2;
|
const DEFAULT_DB_VERSION = 2;
|
||||||
module.exports = class CDB extends require("../code")
|
export default class CDB extends CCode {
|
||||||
{
|
|
||||||
DBHeader100
|
DBHeader100
|
||||||
BlockNumDB
|
BlockNumDB
|
||||||
BlockNumDBMin
|
BlockNumDBMin
|
||||||
@ -70,6 +70,9 @@ module.exports = class CDB extends require("../code")
|
|||||||
this.BlockNumDBMin = StateTX.BlockNumMin
|
this.BlockNumDBMin = StateTX.BlockNumMin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GetBlock(num, bToMem, bReadBody): any {
|
||||||
|
//defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
LoadMemBlocksOnStart() {
|
LoadMemBlocksOnStart() {
|
||||||
this.CurrentBlockNum = global.GetCurrentBlockNumByTime()
|
this.CurrentBlockNum = global.GetCurrentBlockNumByTime()
|
||||||
for (var i = this.BlockNumDB - global.BLOCK_COUNT_IN_MEMORY; i <= this.BlockNumDB; i++)
|
for (var i = this.BlockNumDB - global.BLOCK_COUNT_IN_MEMORY; i <= this.BlockNumDB; i++)
|
||||||
@ -223,6 +226,9 @@ module.exports = class CDB extends require("../code")
|
|||||||
}
|
}
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
OnWriteBlock(Block) {
|
||||||
|
//defiend in transaction-validator.ts(CSmartContract)
|
||||||
|
}
|
||||||
PreSaveDataTreeToDB(Block) {
|
PreSaveDataTreeToDB(Block) {
|
||||||
var Ret = this.WriteBodyDB(Block);
|
var Ret = this.WriteBodyDB(Block);
|
||||||
if (Ret) {
|
if (Ret) {
|
||||||
@ -290,6 +296,9 @@ module.exports = class CDB extends require("../code")
|
|||||||
Block.TrDataLen = TrDataLen
|
Block.TrDataLen = TrDataLen
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
CheckSeqHashDB(Block, StrError): any {
|
||||||
|
//defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
WriteBlockHeaderDB(Block, bPreSave?) {
|
WriteBlockHeaderDB(Block, bPreSave?) {
|
||||||
if (!bPreSave && Block.BlockNum > this.BlockNumDBMin + global.BLOCK_PROCESSING_LENGTH2) {
|
if (!bPreSave && Block.BlockNum > this.BlockNumDBMin + global.BLOCK_PROCESSING_LENGTH2) {
|
||||||
if (global.USE_CHECK_SAVE_DB)
|
if (global.USE_CHECK_SAVE_DB)
|
||||||
@ -570,6 +579,12 @@ module.exports = class CDB extends require("../code")
|
|||||||
this.CreateGenesisBlocks()
|
this.CreateGenesisBlocks()
|
||||||
this.StartSyncBlockchain()
|
this.StartSyncBlockchain()
|
||||||
}
|
}
|
||||||
|
CreateGenesisBlocks() {
|
||||||
|
// defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
|
StartSyncBlockchain(Node?, bSilent?, bCheckPoint?) {
|
||||||
|
// defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
ClearBufMap() {
|
ClearBufMap() {
|
||||||
this.MapHeader = {}
|
this.MapHeader = {}
|
||||||
}
|
}
|
||||||
@ -888,7 +903,7 @@ module.exports = class CDB extends require("../code")
|
|||||||
var SeqHash = global.CalcHashFromArray(arr, true);
|
var SeqHash = global.CalcHashFromArray(arr, true);
|
||||||
return SeqHash;
|
return SeqHash;
|
||||||
}
|
}
|
||||||
CheckCreateTicketObject(Tr, BlockNum, SetTxID) {
|
CheckCreateTicketObject(Tr, BlockNum?, SetTxID?) {
|
||||||
if (!Tr.HashPow && Tr.HashTicket) {
|
if (!Tr.HashPow && Tr.HashTicket) {
|
||||||
Tr.num = BlockNum
|
Tr.num = BlockNum
|
||||||
var FullHashTicket = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
var FullHashTicket = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
@ -902,7 +917,7 @@ module.exports = class CDB extends require("../code")
|
|||||||
Tr.TxID = global.GetHexFromArr(FullHashTicket.slice(0, global.TR_TICKET_HASH_LENGTH + 6))
|
Tr.TxID = global.GetHexFromArr(FullHashTicket.slice(0, global.TR_TICKET_HASH_LENGTH + 6))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckCreateTransactionObject(Tr, SetTxID, NotPrioritet?) {
|
CheckCreateTransactionObject(Tr, SetTxID?, NotPrioritet?) {
|
||||||
if (!Tr.HashPow) {
|
if (!Tr.HashPow) {
|
||||||
var Body = Tr.body;
|
var Body = Tr.body;
|
||||||
Tr.IsTx = 1
|
Tr.IsTx = 1
|
||||||
@ -913,17 +928,6 @@ module.exports = class CDB extends require("../code")
|
|||||||
Tr.HASH = global.shaarr(Body)
|
Tr.HASH = global.shaarr(Body)
|
||||||
Tr.HashTicket = Tr.HASH.slice(0, global.TR_TICKET_HASH_LENGTH)
|
Tr.HashTicket = Tr.HASH.slice(0, global.TR_TICKET_HASH_LENGTH)
|
||||||
this.CheckCreateTicketObject(Tr, Tr.num, SetTxID)
|
this.CheckCreateTicketObject(Tr, Tr.num, SetTxID)
|
||||||
Tr.Prioritet = global.MAX_LENGTH_SENDER_MAP
|
|
||||||
if (!NotPrioritet && this.GetSenderPrioritet) {
|
|
||||||
var App = global.DAppByType[Body[0]];
|
|
||||||
if (App) {
|
|
||||||
Tr.SenderNum = App.GetSenderNum(Tr.num, Body)
|
|
||||||
if (Tr.SenderNum && Tr.SenderNum > 0) {
|
|
||||||
Tr.Prioritet = this.GetSenderPrioritet(Tr.num, Tr.SenderNum)
|
|
||||||
Tr.TimePow = Tr.Prioritet + Tr.power
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlockChainToBuf(WriteNum, StartNum, EndBlockNum) {
|
BlockChainToBuf(WriteNum, StartNum, EndBlockNum) {
|
||||||
@ -1033,3 +1037,19 @@ global.GetNodeStrPort = function(Node) {
|
|||||||
return "" + arr[2] + "." + arr[3];
|
return "" + arr[2] + "." + arr[3];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface Global {
|
||||||
|
//#region block-db.ts
|
||||||
|
BlockDB: any;
|
||||||
|
BLOCK_HEADER_SIZE: number;
|
||||||
|
BLOCK_HEADER_SIZE2: number;
|
||||||
|
DB_VERSION: number;
|
||||||
|
AddInfoChain: Function;
|
||||||
|
AddInfoBlock: Function;
|
||||||
|
GetNodeStrPort: Function;
|
||||||
|
NO_CHECK_BLOCKNUM_ONSTART: number;
|
||||||
|
//#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,18 +10,18 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import Db from './db'
|
||||||
|
|
||||||
module.exports = class CDBState extends require("./db")
|
class DBRow extends Db {
|
||||||
{
|
FileName;
|
||||||
private FileName;
|
DataSize;
|
||||||
private DataSize;
|
Format;
|
||||||
private Format;
|
WorkStruct;
|
||||||
private WorkStruct;
|
FileNameFull;
|
||||||
// private FileNameFull;
|
LastHash;
|
||||||
// private LastHash;
|
WasUpdate;
|
||||||
// private WasUpdate;
|
BufMap;
|
||||||
private BufMap;
|
BufMapCount;
|
||||||
private BufMapCount;
|
|
||||||
|
|
||||||
constructor(FileName, DataSize, Format, bReadOnly) {
|
constructor(FileName, DataSize, Format, bReadOnly) {
|
||||||
super()
|
super()
|
||||||
@ -29,10 +29,10 @@ module.exports = class CDBState extends require("./db")
|
|||||||
this.DataSize = DataSize
|
this.DataSize = DataSize
|
||||||
this.Format = Format
|
this.Format = Format
|
||||||
this.WorkStruct = {}
|
this.WorkStruct = {}
|
||||||
// var FI = this.OpenDBFile(this.FileName, !bReadOnly);
|
var FI = this.OpenDBFile(this.FileName, !bReadOnly);
|
||||||
// this.FileNameFull = FI.fname
|
this.FileNameFull = FI.fname
|
||||||
// this.LastHash = undefined
|
this.LastHash = undefined
|
||||||
// this.WasUpdate = 1
|
this.WasUpdate = 1
|
||||||
this.BufMap = {}
|
this.BufMap = {}
|
||||||
this.BufMapCount = 0
|
this.BufMapCount = 0
|
||||||
setInterval(this.CheckBufMap.bind(this), 1000)
|
setInterval(this.CheckBufMap.bind(this), 1000)
|
||||||
@ -48,8 +48,8 @@ module.exports = class CDBState extends require("./db")
|
|||||||
}
|
}
|
||||||
Write(Data, RetBuf) {
|
Write(Data, RetBuf) {
|
||||||
var startTime = process.hrtime();
|
var startTime = process.hrtime();
|
||||||
// this.LastHash = undefined
|
this.LastHash = undefined
|
||||||
// this.WasUpdate = 1
|
this.WasUpdate = 1
|
||||||
this.CheckNewNum(Data)
|
this.CheckNewNum(Data)
|
||||||
Data.Num = Math.trunc(Data.Num)
|
Data.Num = Math.trunc(Data.Num)
|
||||||
this.DeleteMap(Data.Num)
|
this.DeleteMap(Data.Num)
|
||||||
@ -118,8 +118,8 @@ module.exports = class CDBState extends require("./db")
|
|||||||
Position = 0
|
Position = 0
|
||||||
var FI = this.OpenDBFile(this.FileName, 1);
|
var FI = this.OpenDBFile(this.FileName, 1);
|
||||||
if (Position < FI.size) {
|
if (Position < FI.size) {
|
||||||
// this.LastHash = undefined
|
this.LastHash = undefined
|
||||||
// this.WasUpdate = 1
|
this.WasUpdate = 1
|
||||||
if (LastNum < 0)
|
if (LastNum < 0)
|
||||||
global.ToLog("Truncate " + this.FileName + " from 0", 2)
|
global.ToLog("Truncate " + this.FileName + " from 0", 2)
|
||||||
FI.size = Position
|
FI.size = Position
|
||||||
@ -227,3 +227,5 @@ module.exports = class CDBState extends require("./db")
|
|||||||
this.CloseDBFile(this.FileName)
|
this.CloseDBFile(this.FileName)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default DBRow
|
@ -11,11 +11,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
module.exports = class {
|
class Db {
|
||||||
private DBMap;
|
DBMap;
|
||||||
// private LastHash;
|
LastHash;
|
||||||
// private WasUpdate;
|
WasUpdate;
|
||||||
private WasCheckPathDB;
|
WasCheckPathDB;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.DBMap = {}
|
this.DBMap = {}
|
||||||
@ -24,9 +24,9 @@ module.exports = class {
|
|||||||
var Path = global.GetDataPath("DB");
|
var Path = global.GetDataPath("DB");
|
||||||
global.CheckCreateDir(Path)
|
global.CheckCreateDir(Path)
|
||||||
}
|
}
|
||||||
CloseDBFile(name, bdelete) {
|
CloseDBFile(name, bdelete?) {
|
||||||
// this.LastHash = undefined
|
this.LastHash = undefined
|
||||||
// this.WasUpdate = 1
|
this.WasUpdate = 1
|
||||||
var Item = this.DBMap[name];
|
var Item = this.DBMap[name];
|
||||||
if (Item) {
|
if (Item) {
|
||||||
let bDelete = bdelete;
|
let bDelete = bdelete;
|
||||||
@ -40,23 +40,23 @@ module.exports = class {
|
|||||||
global.ToLog(err)
|
global.ToLog(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
global.ToLog(err)
|
global.ToLog(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
delete this.DBMap[name]
|
delete this.DBMap[name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OpenDBFile(name, bWrite, bExist) {
|
OpenDBFile(name, bWrite?, bExist?) {
|
||||||
if (bWrite && global.READ_ONLY_DB) {
|
if (bWrite && global.READ_ONLY_DB) {
|
||||||
global.ToLogTrace("CANNOT WRITE - DB IN READ_ONLY MODE!!!")
|
global.ToLogTrace("CANNOT WRITE - DB IN READ_ONLY MODE!!!")
|
||||||
process.exit()
|
process.exit()
|
||||||
}
|
}
|
||||||
if (bWrite)
|
if (bWrite) {
|
||||||
CheckStartOneProcess(name + "-run")
|
CheckStartOneProcess(name + "-run")
|
||||||
// this.LastHash = undefined
|
}
|
||||||
// this.WasUpdate = 1
|
this.LastHash = undefined
|
||||||
|
this.WasUpdate = 1
|
||||||
var Item = this.DBMap[name];
|
var Item = this.DBMap[name];
|
||||||
if (Item === undefined) {
|
if (Item === undefined) {
|
||||||
if (!this.WasCheckPathDB) {
|
if (!this.WasCheckPathDB) {
|
||||||
@ -82,7 +82,7 @@ module.exports = class {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
var MapCheckProcess = {};
|
var MapCheckProcess = {};
|
||||||
var BlockDB = new module.exports();
|
var BlockDB = new Db();
|
||||||
|
|
||||||
function CheckStartOneProcess(Name) {
|
function CheckStartOneProcess(Name) {
|
||||||
if (global.UpdateMode)
|
if (global.UpdateMode)
|
||||||
@ -96,11 +96,21 @@ function CheckStartOneProcess(Name) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
BlockDB.OpenDBFile(Name);
|
BlockDB.OpenDBFile(Name);
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
global.ToLog("****** DETECT START ANOTHER PROCESS for: " + Name);
|
global.ToLog("****** DETECT START ANOTHER PROCESS for: " + Name);
|
||||||
global.ToLogTrace("EXIT");
|
global.ToLogTrace("EXIT");
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
global.CheckStartOneProcess = CheckStartOneProcess;
|
global.CheckStartOneProcess = CheckStartOneProcess;
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface Global {
|
||||||
|
//#region dapp.ts
|
||||||
|
CheckStartOneProcess: Function;
|
||||||
|
//#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Db;
|
@ -64,7 +64,7 @@ function Init() {
|
|||||||
if (a) {
|
if (a) {
|
||||||
0;
|
0;
|
||||||
var u = r[10];
|
var u = r[10];
|
||||||
u || (u = r[7]), u || (u = r[5]), MapNames[a] = u;
|
u = (u = u || r[7]) || r[5], MapNames[a] = u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ HTTPCaller.DappStaticCall = function(Params, response) {
|
|||||||
glBlock0 = global.SERVER.ReadBlockHeaderDB(0);
|
glBlock0 = global.SERVER.ReadBlockHeaderDB(0);
|
||||||
var RetValue;
|
var RetValue;
|
||||||
try {
|
try {
|
||||||
RetValue = RunSmartMethod(glBlock0, Account.Value.Smart, Account, 0, 0, undefined, Params.MethodName, Params.Params, 1);
|
RetValue = global.RunSmartMethod(glBlock0, Account.Value.Smart, Account, 0, 0, undefined, Params.MethodName, Params.Params, 1);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
return { result: 0, RetValue: "" + e };
|
return { result: 0, RetValue: "" + e };
|
||||||
@ -651,7 +651,7 @@ HTTPCaller.SendECode = function(Param) {
|
|||||||
}
|
}
|
||||||
return { result: 1, text: "Sent to " + arr.length + " nodes" };
|
return { result: 1, text: "Sent to " + arr.length + " nodes" };
|
||||||
}
|
}
|
||||||
var Node = FindNodeByAddr(Param.Addr, 1);
|
var Node = global.FindNodeByAddr(Param.Addr, 1);
|
||||||
if (Node === undefined)
|
if (Node === undefined)
|
||||||
return { result: 0, text: "Node not found" };
|
return { result: 0, text: "Node not found" };
|
||||||
if (Node === false)
|
if (Node === false)
|
||||||
@ -1574,19 +1574,19 @@ if (global.ELECTRON) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.SendData = OnGetData;
|
exports.SendData = OnGetData;
|
||||||
|
//@ts-ignore
|
||||||
// function RunConsole(StrRun) {
|
function RunConsole(StrRun) {
|
||||||
// var Str = fs.readFileSync("./EXPERIMENTAL/!run-console.js", { encoding: "utf8" });
|
var Str = fs.readFileSync("./EXPERIMENTAL/_run-console.js", { encoding: "utf8" });
|
||||||
// if (StrRun)
|
if (StrRun)
|
||||||
// Str += "\n" + StrRun;
|
Str += "\n" + StrRun;
|
||||||
// try {
|
try {
|
||||||
// var ret = eval(Str);
|
var ret = eval(Str);
|
||||||
// }
|
}
|
||||||
// catch (e) {
|
catch (e) {
|
||||||
// ret = e.message + "\n" + e.stack;
|
ret = e.message + "\n" + e.stack;
|
||||||
// }
|
}
|
||||||
// return ret;
|
return ret;
|
||||||
// };
|
};
|
||||||
var WebWalletUser = {};
|
var WebWalletUser = {};
|
||||||
|
|
||||||
function GetUserContext(Params) {
|
function GetUserContext(Params) {
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
*/
|
*/
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
|
import { RBTree } from 'bintrees'
|
||||||
|
import * as secp256k1 from 'secp256k1';
|
||||||
|
import * as ntpClient from 'ntp-client'
|
||||||
|
import * as stun from 'stun'
|
||||||
|
import * as zip from 'zip'
|
||||||
|
|
||||||
import './constant'
|
import './constant'
|
||||||
import './log'
|
import './log'
|
||||||
@ -27,14 +32,20 @@ String.prototype.right = function(count) {
|
|||||||
else
|
else
|
||||||
return this.substr(0, this.length);
|
return this.substr(0, this.length);
|
||||||
};
|
};
|
||||||
global.RBTree = require('bintrees').RBTree;
|
global.RBTree = RBTree;
|
||||||
global.ntpClient = require('ntp-client');
|
global.ntpClient = ntpClient;
|
||||||
global.Stun = require('stun');
|
global.Stun = stun;
|
||||||
global.ZIP = require("zip");
|
global.ZIP = zip;
|
||||||
// var strOS = os.platform() + "_" + os.arch();
|
global.secp256k1 = secp256k1;
|
||||||
if (!global.secp256k1) {
|
|
||||||
global.secp256k1 = require('secp256k1');
|
export {
|
||||||
|
RBTree,
|
||||||
|
ntpClient,
|
||||||
|
stun,
|
||||||
|
zip,
|
||||||
|
secp256k1
|
||||||
}
|
}
|
||||||
|
|
||||||
require('../HTML/JS/terahashlib.js');
|
require('../HTML/JS/terahashlib.js');
|
||||||
require("./crypto-library");
|
require("./crypto-library");
|
||||||
if (global.USE_PARAM_JS) {
|
if (global.USE_PARAM_JS) {
|
||||||
|
@ -33,7 +33,7 @@ function ToLogFile(e, t, r?) {
|
|||||||
|
|
||||||
function ToLogClient(e, t, r) {
|
function ToLogClient(e, t, r) {
|
||||||
let ArrLogClient = global.ArrLogClient;
|
let ArrLogClient = global.ArrLogClient;
|
||||||
e && (ToLogFile(file_name_log, e), t || (t = ""), ArrLogClient.push({ text: global.GetStrOnlyTime() + " " + e, key: t, final: r }), 13 < ArrLogClient.length && ArrLogClient.shift());
|
e && (ToLogFile(file_name_log, e), t = t || "", ArrLogClient.push({ text: global.GetStrOnlyTime() + " " + e, key: t, final: r }), 13 < ArrLogClient.length && ArrLogClient.shift());
|
||||||
};
|
};
|
||||||
global.CheckSizeLogFile(file_name_error, file_name_errorPrev), global.ToLog = function(e, t) {
|
global.CheckSizeLogFile(file_name_error, file_name_errorPrev), global.ToLog = function(e, t) {
|
||||||
void 0 === t && (t = 1), t && t > global.LOG_LEVEL || (global.ALL_LOG_TO_CLIENT ? ToLogClient(e, void 0, void 0) : ToLogFile(file_name_log,
|
void 0 === t && (t = 1), t && t > global.LOG_LEVEL || (global.ALL_LOG_TO_CLIENT ? ToLogClient(e, void 0, void 0) : ToLogFile(file_name_log,
|
||||||
@ -103,7 +103,7 @@ function CalcInterval(e, t, r) {
|
|||||||
function AddToStatContext(e, t, r?) {
|
function AddToStatContext(e, t, r?) {
|
||||||
void 0 === r && (r = 1);
|
void 0 === r && (r = 1);
|
||||||
var o = e.Total[t];
|
var o = e.Total[t];
|
||||||
o || (o = 0), "MAX:" === t.substr(0, 4) ? o = Math.max(o, r) : o += r, e.Total[t] = o, StartStatTime || (StartStatTime = global.GetStrOnlyTime(0));
|
o = o || 0, "MAX:" === t.substr(0, 4) ? o = Math.max(o, r) : o += r, e.Total[t] = o, StartStatTime = StartStatTime || global.GetCurrentTime(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
function CopyStatInterval(e, t) {
|
function CopyStatInterval(e, t) {
|
||||||
@ -153,7 +153,7 @@ global.HASH_RATE = 0, global.ADD_HASH_RATE = function(e) {
|
|||||||
}
|
}
|
||||||
global.GET_STAT = function(e) {
|
global.GET_STAT = function(e) {
|
||||||
var t = CONTEXT_STATS.Total[e];
|
var t = CONTEXT_STATS.Total[e];
|
||||||
return t || (t = 0), t;
|
return t = t || 0;
|
||||||
}
|
}
|
||||||
global.ADD_TO_STAT_TIME = function(e, t, r) {
|
global.ADD_TO_STAT_TIME = function(e, t, r) {
|
||||||
if (global.STAT_MODE) {
|
if (global.STAT_MODE) {
|
||||||
@ -230,13 +230,13 @@ global.GetStrOnlyTime = function(e) {
|
|||||||
if (!global.GetCurrentTime)
|
if (!global.GetCurrentTime)
|
||||||
return ":::";
|
return ":::";
|
||||||
e || (e = global.GetCurrentTime());
|
e || (e = global.GetCurrentTime());
|
||||||
var t = "" + e.getHours().toStringZ(2);
|
var t = "" + (e = e || global.GetCurrentTime()).getHours().toStringZ(2);
|
||||||
return t = (t = (t = t + ":" + e.getMinutes().toStringZ(2)) + ":" + e.getSeconds().toStringZ(2)) + "." + e.getMilliseconds().toStringZ(3);
|
return t = (t = (t = t + ":" + e.getMinutes().toStringZ(2)) + ":" + e.getSeconds().toStringZ(2)) + "." + e.getMilliseconds().toStringZ(3);
|
||||||
}
|
}
|
||||||
global.GetStrTime = function(e) {
|
global.GetStrTime = function(e) {
|
||||||
if (!global.GetCurrentTime)
|
if (!global.GetCurrentTime)
|
||||||
return ":::";
|
return ":::";
|
||||||
e || (e = global.GetCurrentTime());
|
e || (e = global.GetCurrentTime());
|
||||||
var t = "" + e.getDate().toStringZ(2);
|
var t = "" + (e = e || global.GetCurrentTime()).getDate().toStringZ(2);
|
||||||
return t = (t = (t = (t = (t = (t = t + "." + (1 + e.getMonth()).toStringZ(2)) + "." + e.getFullYear()) + " " + e.getHours().toStringZ(2)) + ":" + e.getMinutes().toStringZ(2)) + ":" + e.getSeconds().toStringZ(2)) + "." + e.getMilliseconds().toStringZ(3);
|
return t = (t = (t = (t = (t = (t = t + "." + (1 + e.getMonth()).toStringZ(2)) + "." + e.getFullYear()) + " " + e.getHours().toStringZ(2)) + ":" + e.getMinutes().toStringZ(2)) + ":" + e.getSeconds().toStringZ(2)) + "." + e.getMilliseconds().toStringZ(3);
|
||||||
};
|
};
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
require("./library");
|
import "./library"
|
||||||
const net = require("net");
|
import net = require("net");
|
||||||
var ConnectIDCount = 1;
|
var ConnectIDCount = 1;
|
||||||
module.exports = class CNode {
|
export default class CNode {
|
||||||
addrStr
|
addrStr
|
||||||
ip
|
ip
|
||||||
port
|
port
|
||||||
|
@ -9,13 +9,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = class CRest extends require("./db/block-db")
|
import CDB from './db/block-db'
|
||||||
{
|
export default class CRest extends CDB {
|
||||||
LoadRestContext
|
LoadRestContext
|
||||||
BlockNumDB
|
BlockNumDB
|
||||||
BlockNumDBMin
|
BlockNumDBMin
|
||||||
UseTruncateBlockDB
|
UseTruncateBlockDB
|
||||||
ContextSendLoadToBegin
|
ContextSendLoadToBegin
|
||||||
|
LoadHistoryContext
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
}
|
}
|
||||||
@ -47,6 +48,15 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
this.LoadRestContext = undefined
|
this.LoadRestContext = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GetNextNode(task, keyid, checktime?, BlockNum?): any {
|
||||||
|
//defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
|
DataFromF(Info, bSendFormat?): any {
|
||||||
|
//defiend in block-loader.ts(CBlock)
|
||||||
|
}
|
||||||
|
AddToBan(Node, Str) {
|
||||||
|
//defiend in server.ts(CTransport)
|
||||||
|
}
|
||||||
LoopSyncRest() {
|
LoopSyncRest() {
|
||||||
let Context = this.LoadRestContext;
|
let Context = this.LoadRestContext;
|
||||||
switch (Context.Mode) {
|
switch (Context.Mode) {
|
||||||
@ -58,7 +68,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Node.SendRestGetHeader = 1
|
Node.SendRestGetHeader = 1
|
||||||
global.ToLog("Send rest get headers from " + Context.BlockNumProof + " to " + NodeName(Node), 2)
|
global.ToLog("Send rest get headers from " + Context.BlockNumProof + " to " + global.NodeName(Node), 2)
|
||||||
this.SendF(Node, {
|
this.SendF(Node, {
|
||||||
"Method": "GETBLOCKHEADER", "Data": { Foward: 1, BlockNum: Context.BlockNumProof, Hash: [] }, "Context": { F: this.RETBLOCKHEADER_REST.bind(this) },
|
"Method": "GETBLOCKHEADER", "Data": { Foward: 1, BlockNum: Context.BlockNumProof, Hash: [] }, "Context": { F: this.RETBLOCKHEADER_REST.bind(this) },
|
||||||
})
|
})
|
||||||
@ -96,7 +106,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
var Item = Context.ArrProof[i];
|
var Item = Context.ArrProof[i];
|
||||||
if (Item.SumPower !== MaxPow) {
|
if (Item.SumPower !== MaxPow) {
|
||||||
var Str = "BAD SumPower: " + Item.SumPower + "/" + MaxPow;
|
var Str = "BAD SumPower: " + Item.SumPower + "/" + MaxPow;
|
||||||
global.ToLog(Str + " from: " + NodeName(Item.Node), 2)
|
global.ToLog(Str + " from: " + global.NodeName(Item.Node), 2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Item.SumPower && Item.arr.length >= Context.CountProof) {
|
if (Item.SumPower && Item.arr.length >= Context.CountProof) {
|
||||||
@ -116,6 +126,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
this.BlockNumDBMin = Block.BlockNum
|
this.BlockNumDBMin = Block.BlockNum
|
||||||
this.WriteBlockHeaderDB(Block)
|
this.WriteBlockHeaderDB(Block)
|
||||||
this.UseTruncateBlockDB = undefined
|
this.UseTruncateBlockDB = undefined
|
||||||
|
global.ToLog("Start run TXPrepareLoadRest", 2)
|
||||||
global.TX_PROCESS.RunRPC("TXPrepareLoadRest", Block.BlockNum, function(Err, Params) {
|
global.TX_PROCESS.RunRPC("TXPrepareLoadRest", Block.BlockNum, function(Err, Params) {
|
||||||
Context.Mode++
|
Context.Mode++
|
||||||
global.ToLog("Next mode: " + Context.Mode, 2)
|
global.ToLog("Next mode: " + Context.Mode, 2)
|
||||||
@ -132,7 +143,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
let Item = Context.ArrProof[i];
|
let Item = Context.ArrProof[i];
|
||||||
if (Item.OK) {
|
if (Item.OK) {
|
||||||
SendCount++
|
SendCount++
|
||||||
global.ToLog("Send rest get block proof:" + BlockProof.BlockNum + " to " + NodeName(Item.Node), 2)
|
global.ToLog("Send rest get block proof:" + BlockProof.BlockNum + " to " + global.NodeName(Item.Node), 2)
|
||||||
this.SendF(Item.Node, {
|
this.SendF(Item.Node, {
|
||||||
"Method": "GETBLOCK", "Data": { BlockNum: BlockProof.BlockNum, TreeHash: BlockProof.TreeHash }, "Context": {
|
"Method": "GETBLOCK", "Data": { BlockNum: BlockProof.BlockNum, TreeHash: BlockProof.TreeHash }, "Context": {
|
||||||
F: function(Info) {
|
F: function(Info) {
|
||||||
@ -141,15 +152,15 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
var Data = global.BufLib.GetObjectFromBuffer(Info.Data, global.FORMAT_BLOCK_TRANSFER, global.WRK_BLOCK_TRANSFER);
|
var Data = global.BufLib.GetObjectFromBuffer(Info.Data, global.FORMAT_BLOCK_TRANSFER, global.WRK_BLOCK_TRANSFER);
|
||||||
Info.Data = undefined
|
Info.Data = undefined
|
||||||
if (Data.BlockNum !== BlockProof.BlockNum || global.CompareArr(Data.TreeHash, BlockProof.TreeHash) !== 0) {
|
if (Data.BlockNum !== BlockProof.BlockNum || global.CompareArr(Data.TreeHash, BlockProof.TreeHash) !== 0) {
|
||||||
global.ToLog("Error get proof block from " + NodeName(Item.Node), 2)
|
global.ToLog("Error get proof block from " + global.NodeName(Item.Node), 2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var TreeHash = global.CalcTreeHashFromArrBody(Data.BlockNum, Data.arrContent);
|
var TreeHash = global.CalcTreeHashFromArrBody(Data.BlockNum, Data.arrContent);
|
||||||
if (global.CompareArr(BlockProof.TreeHash, TreeHash) !== 0) {
|
if (global.CompareArr(BlockProof.TreeHash, TreeHash) !== 0) {
|
||||||
global.ToLog("Error TreeHash in proof block from " + NodeName(Item.Node), 2)
|
global.ToLog("Error TreeHash in proof block from " + global.NodeName(Item.Node), 2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
global.ToLog("GET BLOCK proof from " + NodeName(Item.Node), 2)
|
global.ToLog("GET BLOCK proof from " + global.NodeName(Item.Node), 2)
|
||||||
var FindTx = undefined;
|
var FindTx = undefined;
|
||||||
for (var n = 0; n < Data.arrContent.length; n++) {
|
for (var n = 0; n < Data.arrContent.length; n++) {
|
||||||
var Body = Data.arrContent[n];
|
var Body = Data.arrContent[n];
|
||||||
@ -211,7 +222,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
if (Delta > 5 * 1000 && !Task.OK) {
|
if (Delta > 5 * 1000 && !Task.OK) {
|
||||||
var Ret = this.GetNextNode(Task, "", 1);
|
var Ret = this.GetNextNode(Task, "", 1);
|
||||||
if (Ret.Result) {
|
if (Ret.Result) {
|
||||||
global.ToLog("Send GETREST Num:" + Task.StartNum + "-" + Task.Count + " to " + NodeName(Ret.Node), 2)
|
global.ToLog("Send GETREST Num:" + Task.StartNum + "-" + Task.Count + " to " + global.NodeName(Ret.Node), 2)
|
||||||
var SELF = this;
|
var SELF = this;
|
||||||
this.SendF(Ret.Node, {
|
this.SendF(Ret.Node, {
|
||||||
"Method": "GETREST", "Data": { BlockNum: Context.BlockNumRest, AccNum: Task.StartNum, Count: Task.Count, AccHash: Context.TxProof.AccHash },
|
"Method": "GETREST", "Data": { BlockNum: Context.BlockNumRest, AccNum: Task.StartNum, Count: Task.Count, AccHash: Context.TxProof.AccHash },
|
||||||
@ -223,11 +234,11 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
if (!Data.Result)
|
if (!Data.Result)
|
||||||
return;
|
return;
|
||||||
if (Data.Version !== 1) {
|
if (Data.Version !== 1) {
|
||||||
global.ToLog("ERROR Version Result GETREST Num:" + Task.StartNum + " from " + NodeName(Info.Node), 2)
|
global.ToLog("ERROR Version Result GETREST Num:" + Task.StartNum + " from " + global.NodeName(Info.Node), 2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (global.CompareArrL(Data.ProofHash, Context.TxProof.AccHash) !== 0) {
|
if (global.CompareArrL(Data.ProofHash, Context.TxProof.AccHash) !== 0) {
|
||||||
global.ToLog("ERROR PROOF HASH Result GETREST Num:" + Task.StartNum + " Hash: " + global.GetHexFromArr(Data.ProofHash) + "/" + global.GetHexFromArr(Context.TxProof.AccHash) + " from " + NodeName(Info.Node),
|
global.ToLog("ERROR PROOF HASH Result GETREST Num:" + Task.StartNum + " Hash: " + global.GetHexFromArr(Data.ProofHash) + "/" + global.GetHexFromArr(Context.TxProof.AccHash) + " from " + global.NodeName(Info.Node),
|
||||||
2)
|
2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -237,11 +248,11 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
}
|
}
|
||||||
var GetHash = global.CheckMerkleProof(Data.ProofArrL, ArrM, Data.ProofArrR);
|
var GetHash = global.CheckMerkleProof(Data.ProofArrL, ArrM, Data.ProofArrR);
|
||||||
if (global.CompareArrL(GetHash, Context.TxProof.AccHash) !== 0) {
|
if (global.CompareArrL(GetHash, Context.TxProof.AccHash) !== 0) {
|
||||||
global.ToLog("ERROR CALC PROOF HASH Result GETREST Num:" + Task.StartNum + " Hash: " + global.GetHexFromArr(GetHash) + "/" + global.GetHexFromArr(Context.TxProof.AccHash) + " from " + NodeName(Info.Node),
|
global.ToLog("ERROR CALC PROOF HASH Result GETREST Num:" + Task.StartNum + " Hash: " + global.GetHexFromArr(GetHash) + "/" + global.GetHexFromArr(Context.TxProof.AccHash) + " from " + global.NodeName(Info.Node),
|
||||||
2)
|
2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
global.ToLog("OK Result GETREST Num:" + Task.StartNum + " arr=" + Data.Arr.length + " from " + NodeName(Info.Node), 2)
|
global.ToLog("OK Result GETREST Num:" + Task.StartNum + " arr=" + Data.Arr.length + " from " + global.NodeName(Info.Node), 2)
|
||||||
if (!global.TX_PROCESS || !global.TX_PROCESS.RunRPC) {
|
if (!global.TX_PROCESS || !global.TX_PROCESS.RunRPC) {
|
||||||
global.ToLog("ERROR global.TX_PROCESS")
|
global.ToLog("ERROR global.TX_PROCESS")
|
||||||
return;
|
return;
|
||||||
@ -272,7 +283,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
if (Delta > 3 * 1000 && !Task.OK) {
|
if (Delta > 3 * 1000 && !Task.OK) {
|
||||||
var Ret = this.GetNextNode(Task, "", 1);
|
var Ret = this.GetNextNode(Task, "", 1);
|
||||||
if (Ret.Result) {
|
if (Ret.Result) {
|
||||||
global.ToLog("Send GETSMART Num:" + Task.StartNum + "-" + Task.Count + " to " + NodeName(Ret.Node), 2)
|
global.ToLog("Send GETSMART Num:" + Task.StartNum + "-" + Task.Count + " to " + global.NodeName(Ret.Node), 2)
|
||||||
var SELF = this;
|
var SELF = this;
|
||||||
this.SendF(Ret.Node, {
|
this.SendF(Ret.Node, {
|
||||||
"Method": "GETSMART", "Data": { BlockNum: Context.BlockNumRest, SmartNum: Task.StartNum, Count: Task.Count },
|
"Method": "GETSMART", "Data": { BlockNum: Context.BlockNumRest, SmartNum: Task.StartNum, Count: Task.Count },
|
||||||
@ -283,7 +294,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
var Data = SELF.DataFromF(Info);
|
var Data = SELF.DataFromF(Info);
|
||||||
if (!Data.Result)
|
if (!Data.Result)
|
||||||
return;
|
return;
|
||||||
global.ToLog("Result GETSMART Num:" + Task.StartNum + " arr=" + Data.Arr.length + " from " + NodeName(Info.Node), 2)
|
global.ToLog("Result GETSMART Num:" + Task.StartNum + " arr=" + Data.Arr.length + " from " + global.NodeName(Info.Node), 2)
|
||||||
Task.Node = Info.Node
|
Task.Node = Info.Node
|
||||||
if (!global.TX_PROCESS || !global.TX_PROCESS.RunRPC)
|
if (!global.TX_PROCESS || !global.TX_PROCESS.RunRPC)
|
||||||
return;
|
return;
|
||||||
@ -358,6 +369,9 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
global.ToLog("Error state!")
|
global.ToLog("Error state!")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
GetBlockArrFromBuffer_Load(BufRead, Info?): any {
|
||||||
|
|
||||||
}
|
}
|
||||||
RETBLOCKHEADER_REST(Info, CurTime) {
|
RETBLOCKHEADER_REST(Info, CurTime) {
|
||||||
if (Info.Node.SendRestGetHeader === 2)
|
if (Info.Node.SendRestGetHeader === 2)
|
||||||
@ -366,7 +380,7 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
var Context = this.LoadRestContext;
|
var Context = this.LoadRestContext;
|
||||||
var BufRead = global.BufLib.GetReadBuffer(Info.Data);
|
var BufRead = global.BufLib.GetReadBuffer(Info.Data);
|
||||||
var arr = this.GetBlockArrFromBuffer_Load(BufRead, Info);
|
var arr = this.GetBlockArrFromBuffer_Load(BufRead, Info);
|
||||||
global.ToLog("RETBLOCKHEADER_FOWARD SyncRest from " + NodeName(Info.Node) + " arr=" + arr.length, 2)
|
global.ToLog("RETBLOCKHEADER_FOWARD SyncRest from " + global.NodeName(Info.Node) + " arr=" + arr.length, 2)
|
||||||
Context.ReceiveHeaderCount++
|
Context.ReceiveHeaderCount++
|
||||||
var MinSumPow = 10 * Context.CountProof;
|
var MinSumPow = 10 * Context.CountProof;
|
||||||
var SumPower = 0;
|
var SumPower = 0;
|
||||||
@ -420,13 +434,13 @@ module.exports = class CRest extends require("./db/block-db")
|
|||||||
var Ret = this.GetNextNode(Context, Context.BlockNum, 1);
|
var Ret = this.GetNextNode(Context, Context.BlockNum, 1);
|
||||||
if (Ret.Result) {
|
if (Ret.Result) {
|
||||||
var Node = Ret.Node;
|
var Node = Ret.Node;
|
||||||
global.ToLog("LOAD_TO_BEGIN - from: " + BlockDB.BlockNum + " to " + NodeName(Node), 2)
|
global.ToLog("LOAD_TO_BEGIN - from: " + BlockDB.BlockNum + " to " + global.NodeName(Node), 2)
|
||||||
Context.Time = CurTime
|
Context.Time = CurTime
|
||||||
this.SendF(Node, {
|
this.SendF(Node, {
|
||||||
"Method": "GETBLOCKHEADER", "Data": { Foward: 0, BlockNum: Context.BlockNum, Hash: BlockDB.Hash, IsSum: 0, Count: global.COUNT_HISTORY_BLOCKS_FOR_LOAD },
|
"Method": "GETBLOCKHEADER", "Data": { Foward: 0, BlockNum: Context.BlockNum, Hash: BlockDB.Hash, IsSum: 0, Count: global.COUNT_HISTORY_BLOCKS_FOR_LOAD },
|
||||||
"Context": {
|
"Context": {
|
||||||
F: function(Info) {
|
F: function(Info) {
|
||||||
global.ToLog("GET LOAD_TO_BEGIN from " + NodeName(Info.Node) + " Length=" + Info.Data.length, 2)
|
global.ToLog("GET LOAD_TO_BEGIN from " + global.NodeName(Info.Node) + " Length=" + Info.Data.length, 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -14,6 +14,7 @@ import net = require("net");
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import "./library"
|
import "./library"
|
||||||
import "./crypto-library"
|
import "./crypto-library"
|
||||||
|
import CConnect from './connect'
|
||||||
const HARD_PACKET_PERIOD = 20;
|
const HARD_PACKET_PERIOD = 20;
|
||||||
global.BUF_TYPE = 1;
|
global.BUF_TYPE = 1;
|
||||||
global.STR_TYPE = 2;
|
global.STR_TYPE = 2;
|
||||||
@ -57,12 +58,9 @@ const FORMAT_PACKET_SEND_TCP = "{\
|
|||||||
Hash:hash,\
|
Hash:hash,\
|
||||||
Data:data,\
|
Data:data,\
|
||||||
}";
|
}";
|
||||||
export default class CTransport extends require("./connect")
|
export default class CTransport extends CConnect {
|
||||||
{
|
|
||||||
UseRNDHeader
|
UseRNDHeader
|
||||||
BAN_IP
|
BAN_IP
|
||||||
ip
|
|
||||||
port
|
|
||||||
CanSend
|
CanSend
|
||||||
SendFormatMap
|
SendFormatMap
|
||||||
ActualNodes
|
ActualNodes
|
||||||
@ -233,7 +231,7 @@ export default class CTransport extends require("./connect")
|
|||||||
this.SendTrafficFree -= Node.SendTrafficLimit
|
this.SendTrafficFree -= Node.SendTrafficLimit
|
||||||
}
|
}
|
||||||
Node.SendTrafficCurrent = 0
|
Node.SendTrafficCurrent = 0
|
||||||
global.ADD_TO_STAT("MAX:NODE_TRAFFIC_LIMIT:" + NodeName(Node), 1000 / global.STAT_PERIOD * Node.SendTrafficLimit / 1024, 1)
|
global.ADD_TO_STAT("MAX:NODE_TRAFFIC_LIMIT:" + global.NodeName(Node), 1000 / global.STAT_PERIOD * Node.SendTrafficLimit / 1024, 1)
|
||||||
}
|
}
|
||||||
this.SendTrafficFree += TRAFIC_LIMIT_NODE
|
this.SendTrafficFree += TRAFIC_LIMIT_NODE
|
||||||
global.ADD_TO_STAT("SEND_TRAFFIC_FREE", this.SendTrafficFree / 1024)
|
global.ADD_TO_STAT("SEND_TRAFFIC_FREE", this.SendTrafficFree / 1024)
|
||||||
@ -243,7 +241,7 @@ export default class CTransport extends require("./connect")
|
|||||||
var Str = "";
|
var Str = "";
|
||||||
if (Info.Data && Info.Data.Length)
|
if (Info.Data && Info.Data.Length)
|
||||||
Str = " LENGTH=" + Info.Data.Length
|
Str = " LENGTH=" + Info.Data.Length
|
||||||
global.TO_DEBUG_LOG("GET:" + Info.Method + Str + " from: Node=" + NodeInfo(Info.Node))
|
global.TO_DEBUG_LOG("GET:" + Info.Method + Str + " from: Node=" + global.NodeInfo(Info.Node))
|
||||||
}
|
}
|
||||||
if (global.ADDRLIST_MODE) {
|
if (global.ADDRLIST_MODE) {
|
||||||
var StrOK = ",HAND,GETNODES,";
|
var StrOK = ",HAND,GETNODES,";
|
||||||
@ -269,7 +267,7 @@ export default class CTransport extends require("./connect")
|
|||||||
var Arr = [];
|
var Arr = [];
|
||||||
var it = this.ActualNodes.iterator(), Item;
|
var it = this.ActualNodes.iterator(), Item;
|
||||||
while ((Item = it.next()) !== null) {
|
while ((Item = it.next()) !== null) {
|
||||||
if (GetSocketStatus(Item.Socket) >= 100)
|
if (global.GetSocketStatus(Item.Socket) >= 100)
|
||||||
Arr.push(Item)
|
Arr.push(Item)
|
||||||
else {
|
else {
|
||||||
this.DeleteNodeFromActive(Item)
|
this.DeleteNodeFromActive(Item)
|
||||||
@ -467,7 +465,7 @@ export default class CTransport extends require("./connect")
|
|||||||
return 0;
|
return 0;
|
||||||
var startTime = process.hrtime();
|
var startTime = process.hrtime();
|
||||||
global.ADD_TO_STAT("GETDATA(KB)", buf.length / 1024)
|
global.ADD_TO_STAT("GETDATA(KB)", buf.length / 1024)
|
||||||
global.ADD_TO_STAT("GETDATA(KB):" + NodeName(Node), buf.length / 1024, 1)
|
global.ADD_TO_STAT("GETDATA(KB):" + global.NodeName(Node), buf.length / 1024, 1)
|
||||||
if (!Node.TransferSize)
|
if (!Node.TransferSize)
|
||||||
Node.TransferSize = 0
|
Node.TransferSize = 0
|
||||||
Node.TransferSize += buf.length / 1024
|
Node.TransferSize += buf.length / 1024
|
||||||
@ -480,7 +478,7 @@ export default class CTransport extends require("./connect")
|
|||||||
}
|
}
|
||||||
global.ADD_TO_STAT("GET:" + Buf.Method)
|
global.ADD_TO_STAT("GET:" + Buf.Method)
|
||||||
global.ADD_TO_STAT("GET:(KB)" + Buf.Method, buf.length / 1024)
|
global.ADD_TO_STAT("GET:(KB)" + Buf.Method, buf.length / 1024)
|
||||||
global.ADD_TO_STAT("GET:" + Buf.Method + ":" + NodeName(Node), 1, 1)
|
global.ADD_TO_STAT("GET:" + Buf.Method + ":" + global.NodeName(Node), 1, 1)
|
||||||
var Param = this.MethodTiming[Buf.Method];
|
var Param = this.MethodTiming[Buf.Method];
|
||||||
if (this.StopDoSendPacket(Param, Node, Buf.Method)) {
|
if (this.StopDoSendPacket(Param, Node, Buf.Method)) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -679,8 +677,8 @@ export default class CTransport extends require("./connect")
|
|||||||
Info = Node.SendPacket.min()
|
Info = Node.SendPacket.min()
|
||||||
if (!Info)
|
if (!Info)
|
||||||
return 0;
|
return 0;
|
||||||
global.ADD_TO_STAT("MAX:NODE_BUF_WRITE:" + NodeName(Node), Node.BufWrite.length / 1024, 1)
|
global.ADD_TO_STAT("MAX:NODE_BUF_WRITE:" + global.NodeName(Node), Node.BufWrite.length / 1024, 1)
|
||||||
global.ADD_TO_STAT("MAX:NODE_SEND_BUF_PACKET_COUNT:" + NodeName(Node), Node.SendPacket.size, 1)
|
global.ADD_TO_STAT("MAX:NODE_SEND_BUF_PACKET_COUNT:" + global.NodeName(Node), Node.SendPacket.size, 1)
|
||||||
if (Node.BufWrite.length > 2 * TRAFIC_LIMIT_1S) {
|
if (Node.BufWrite.length > 2 * TRAFIC_LIMIT_1S) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -698,8 +696,8 @@ export default class CTransport extends require("./connect")
|
|||||||
Node.BufWrite = Buffer.concat([Node.BufWrite, BufWrite])
|
Node.BufWrite = Buffer.concat([Node.BufWrite, BufWrite])
|
||||||
global.ADD_TO_STAT("SEND:" + Info.Method)
|
global.ADD_TO_STAT("SEND:" + Info.Method)
|
||||||
global.ADD_TO_STAT("SEND:(KB)" + Info.Method, BufWrite.length / 1024)
|
global.ADD_TO_STAT("SEND:(KB)" + Info.Method, BufWrite.length / 1024)
|
||||||
global.ADD_TO_STAT("SEND:" + Info.Method + ":" + NodeName(Node), 1, 1)
|
global.ADD_TO_STAT("SEND:" + Info.Method + ":" + global.NodeName(Node), 1, 1)
|
||||||
global.TO_DEBUG_LOG("SEND " + Info.Method + " to " + NodeInfo(Node) + " LENGTH=" + BufWrite.length)
|
global.TO_DEBUG_LOG("SEND " + Info.Method + " to " + global.NodeInfo(Node) + " LENGTH=" + BufWrite.length)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DoSendPacket() {
|
DoSendPacket() {
|
||||||
@ -728,7 +726,7 @@ export default class CTransport extends require("./connect")
|
|||||||
var CanCountSend = Node.SendTrafficLimit - Node.SendTrafficCurrent;
|
var CanCountSend = Node.SendTrafficLimit - Node.SendTrafficCurrent;
|
||||||
if (CanCountSend < CountSend) {
|
if (CanCountSend < CountSend) {
|
||||||
if (this.SendTrafficFree < CountSend) {
|
if (this.SendTrafficFree < CountSend) {
|
||||||
global.ADD_TO_STAT("LIMIT_SENDDATA:" + NodeName(Node), Value, 1)
|
global.ADD_TO_STAT("LIMIT_SENDDATA:" + global.NodeName(Node), Value, 1)
|
||||||
continue NEXT_NODE;
|
continue NEXT_NODE;
|
||||||
}
|
}
|
||||||
this.SendTrafficFree -= CountSend
|
this.SendTrafficFree -= CountSend
|
||||||
@ -739,7 +737,7 @@ export default class CTransport extends require("./connect")
|
|||||||
Node.BufWrite = Node.BufWrite.slice(CountSend)
|
Node.BufWrite = Node.BufWrite.slice(CountSend)
|
||||||
this.ADD_CURRENT_STAT_TIME("SEND_DATA", Value)
|
this.ADD_CURRENT_STAT_TIME("SEND_DATA", Value)
|
||||||
global.ADD_TO_STAT("SENDDATA(KB)", Value)
|
global.ADD_TO_STAT("SENDDATA(KB)", Value)
|
||||||
global.ADD_TO_STAT("SENDDATA(KB):" + NodeName(Node), Value, 1)
|
global.ADD_TO_STAT("SENDDATA(KB):" + global.NodeName(Node), Value, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckPOWTicketConnect(Socket, data) {
|
CheckPOWTicketConnect(Socket, data) {
|
||||||
@ -773,18 +771,18 @@ export default class CTransport extends require("./connect")
|
|||||||
Node.NextConnectDelta = 1000
|
Node.NextConnectDelta = 1000
|
||||||
Node.WaitConnectFromServer = 0
|
Node.WaitConnectFromServer = 0
|
||||||
Node.GrayConnect = 0
|
Node.GrayConnect = 0
|
||||||
global.AddNodeInfo(Node, "3. SERVER OK CONNECT for client node " + SocketInfo(Socket))
|
global.AddNodeInfo(Node, "3. SERVER OK CONNECT for client node " + global.SocketInfo(Socket))
|
||||||
this.AddNodeToActive(Node)
|
this.AddNodeToActive(Node)
|
||||||
Node.Socket = Socket
|
Node.Socket = Socket
|
||||||
SetSocketStatus(Socket, 3)
|
global.SetSocketStatus(Socket, 3)
|
||||||
SetSocketStatus(Socket, 100)
|
global.SetSocketStatus(Socket, 100)
|
||||||
Socket.Node = Node
|
Socket.Node = Node
|
||||||
Socket.write(this.GetBufFromData("POW_CONNECT0", "OK", 2))
|
Socket.write(this.GetBufFromData("POW_CONNECT0", "OK", 2))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Node.NextConnectDelta = 60 * 1000
|
Node.NextConnectDelta = 60 * 1000
|
||||||
global.ToLog("Error Sign Node from " + NodeInfo(Node))
|
global.ToLog("Error Sign Node from " + global.NodeInfo(Node))
|
||||||
this.AddCheckErrCount(Node, 10, "Error Sign Node")
|
this.AddCheckErrCount(Node, 10, "Error Sign Node")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -820,7 +818,7 @@ export default class CTransport extends require("./connect")
|
|||||||
this.AddToBanIP(Socket.remoteAddress, "ERROR_SIGN_CLIENT")
|
this.AddToBanIP(Socket.remoteAddress, "ERROR_SIGN_CLIENT")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
global.AddNodeInfo(Node, "1. SERVER OK POW for client node " + SocketInfo(Socket))
|
global.AddNodeInfo(Node, "1. SERVER OK POW for client node " + global.SocketInfo(Socket))
|
||||||
Node.FromIP = Info.FromIP
|
Node.FromIP = Info.FromIP
|
||||||
Node.FromPort = Info.FromPort
|
Node.FromPort = Info.FromPort
|
||||||
Node.SecretForReconnect = crypto.randomBytes(20)
|
Node.SecretForReconnect = crypto.randomBytes(20)
|
||||||
@ -829,11 +827,11 @@ export default class CTransport extends require("./connect")
|
|||||||
Node.NextConnectDelta = 1000
|
Node.NextConnectDelta = 1000
|
||||||
Node.WaitConnectFromServer = 0
|
Node.WaitConnectFromServer = 0
|
||||||
Node.GrayConnect = 1
|
Node.GrayConnect = 1
|
||||||
global.AddNodeInfo(Node, "5. CLIENT OK GRAY CONNECT " + SocketInfo(Socket))
|
global.AddNodeInfo(Node, "5. CLIENT OK GRAY CONNECT " + global.SocketInfo(Socket))
|
||||||
this.AddNodeToActive(Node)
|
this.AddNodeToActive(Node)
|
||||||
Node.Socket = Socket
|
Node.Socket = Socket
|
||||||
SetSocketStatus(Socket, 3)
|
global.SetSocketStatus(Socket, 3)
|
||||||
SetSocketStatus(Socket, 100)
|
global.SetSocketStatus(Socket, 100)
|
||||||
Socket.Node = Node
|
Socket.Node = Node
|
||||||
Socket.write(this.GetBufFromData("POW_CONNECT0", "OK", 2))
|
Socket.write(this.GetBufFromData("POW_CONNECT0", "OK", 2))
|
||||||
return;
|
return;
|
||||||
@ -865,7 +863,7 @@ export default class CTransport extends require("./connect")
|
|||||||
}
|
}
|
||||||
let SOCKET = sock;
|
let SOCKET = sock;
|
||||||
global.socketInit(SOCKET, "c")
|
global.socketInit(SOCKET, "c")
|
||||||
SetSocketStatus(SOCKET, 0)
|
global.SetSocketStatus(SOCKET, 0)
|
||||||
global.AddNodeInfo(SOCKET, "Client *" + SOCKET.ConnectID + " connected from " + SOCKET.remoteAddress + ":" + SOCKET.remotePort, 1)
|
global.AddNodeInfo(SOCKET, "Client *" + SOCKET.ConnectID + " connected from " + SOCKET.remoteAddress + ":" + SOCKET.remotePort, 1)
|
||||||
global.ADD_TO_STAT("ClientConnected")
|
global.ADD_TO_STAT("ClientConnected")
|
||||||
SOCKET.HashRND = crypto.randomBytes(32)
|
SOCKET.HashRND = crypto.randomBytes(32)
|
||||||
@ -904,9 +902,9 @@ export default class CTransport extends require("./connect")
|
|||||||
SOCKET.on('end', function() {
|
SOCKET.on('end', function() {
|
||||||
global.ADD_TO_STAT("ClientEnd")
|
global.ADD_TO_STAT("ClientEnd")
|
||||||
var Node = SOCKET.Node;
|
var Node = SOCKET.Node;
|
||||||
var Status = GetSocketStatus(SOCKET);
|
var Status = global.GetSocketStatus(SOCKET);
|
||||||
if (Status)
|
if (Status)
|
||||||
global.AddNodeInfo(Node, "Get socket end *" + SOCKET.ConnectID + " from client Stat: " + SocketStatistic(SOCKET))
|
global.AddNodeInfo(Node, "Get socket end *" + SOCKET.ConnectID + " from client Stat: " + global.SocketStatistic(SOCKET))
|
||||||
if (Node && Status === 200) {
|
if (Node && Status === 200) {
|
||||||
Node.SwapSockets()
|
Node.SwapSockets()
|
||||||
SOCKET.WasClose = 1
|
SOCKET.WasClose = 1
|
||||||
@ -914,12 +912,12 @@ export default class CTransport extends require("./connect")
|
|||||||
})
|
})
|
||||||
SOCKET.on('close', function(err) {
|
SOCKET.on('close', function(err) {
|
||||||
global.ADD_TO_STAT("ClientClose")
|
global.ADD_TO_STAT("ClientClose")
|
||||||
if (SOCKET.ConnectID && GetSocketStatus(SOCKET))
|
if (SOCKET.ConnectID && global.GetSocketStatus(SOCKET))
|
||||||
global.AddNodeInfo(SOCKET.Node, "Get socket close *" + SOCKET.ConnectID + " from client Stat: " + SocketStatistic(SOCKET))
|
global.AddNodeInfo(SOCKET.Node, "Get socket close *" + SOCKET.ConnectID + " from client Stat: " + global.SocketStatistic(SOCKET))
|
||||||
if (!SOCKET.WasClose && SOCKET.Node) {
|
if (!SOCKET.WasClose && SOCKET.Node) {
|
||||||
global.CloseSocket(SOCKET, "GET CLOSE")
|
global.CloseSocket(SOCKET, "GET CLOSE")
|
||||||
}
|
}
|
||||||
SetSocketStatus(SOCKET, 0)
|
global.SetSocketStatus(SOCKET, 0)
|
||||||
})
|
})
|
||||||
SOCKET.on('error', function(err) {
|
SOCKET.on('error', function(err) {
|
||||||
global.ADD_TO_STAT("ERRORS")
|
global.ADD_TO_STAT("ERRORS")
|
||||||
@ -999,7 +997,7 @@ export default class CTransport extends require("./connect")
|
|||||||
global.CloseSocket(Context.Socket, "CLOSE_SOCKET")
|
global.CloseSocket(Context.Socket, "CLOSE_SOCKET")
|
||||||
}
|
}
|
||||||
SendCloseSocket(Socket, Str) {
|
SendCloseSocket(Socket, Str) {
|
||||||
global.AddNodeInfo(Socket.Node, "CLOSE_SOCKET " + SocketInfo(Socket) + " - " + Str)
|
global.AddNodeInfo(Socket.Node, "CLOSE_SOCKET " + global.SocketInfo(Socket) + " - " + Str)
|
||||||
if (Socket.WasClose) {
|
if (Socket.WasClose) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import CConsensus from './block-exchange'
|
||||||
require("../system/dapp");
|
require("../system/dapp");
|
||||||
require("../system/accounts");
|
require("../system/accounts");
|
||||||
require("../system/smart");
|
require("../system/smart");
|
||||||
@ -17,13 +18,20 @@ require("../system/messager");
|
|||||||
require("../system/names");
|
require("../system/names");
|
||||||
if (global.PROCESS_NAME === "MAIN" || global.PROCESS_NAME === "TX")
|
if (global.PROCESS_NAME === "MAIN" || global.PROCESS_NAME === "TX")
|
||||||
require("./wallet");
|
require("./wallet");
|
||||||
module.exports = class CSmartContract extends require("./block-exchange")
|
export default class CSmartContract extends CConsensus {
|
||||||
{
|
|
||||||
BufHashTree
|
BufHashTree
|
||||||
|
SenderBlockHashMap
|
||||||
|
SenderMap
|
||||||
|
WasReloadSenderMapFromDB
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
this.BufHashTree = new global.RBTree(global.CompareArr)
|
this.BufHashTree = new global.RBTree(global.CompareArr)
|
||||||
this.BufHashTree.LastAddNum = 0
|
this.BufHashTree.LastAddNum = 0
|
||||||
|
this.SenderBlockHashMap = {}
|
||||||
|
this.SenderMap = {}
|
||||||
|
if (!global.ADDRLIST_MODE && !this.VirtualMode && global.START_SERVER) {
|
||||||
|
setInterval(this.ClearOldSenderMapItem.bind(this), 10000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AddBlockToHashTree(Block) {
|
AddBlockToHashTree(Block) {
|
||||||
this.BufHashTree.LastAddNum = Block.BlockNum
|
this.BufHashTree.LastAddNum = Block.BlockNum
|
||||||
@ -45,6 +53,9 @@ module.exports = class CSmartContract extends require("./block-exchange")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnWriteBlock(Block) {
|
OnWriteBlock(Block) {
|
||||||
|
this.AddToSenderMap(Block)
|
||||||
|
}
|
||||||
|
OnDelete(Block) {
|
||||||
}
|
}
|
||||||
BlockProcessTX(Block) {
|
BlockProcessTX(Block) {
|
||||||
if (Block.BlockNum < 1)
|
if (Block.BlockNum < 1)
|
||||||
@ -82,7 +93,7 @@ module.exports = class CSmartContract extends require("./block-exchange")
|
|||||||
var arr = Block.arrContent;
|
var arr = Block.arrContent;
|
||||||
if (arr)
|
if (arr)
|
||||||
for (var i = 0; i < arr.length; i++) {
|
for (var i = 0; i < arr.length; i++) {
|
||||||
var HASH = global.shaarr(arr[i]);
|
var HASH = global.sha3(arr[i]);
|
||||||
if (this.BufHashTree.find(HASH)) {
|
if (this.BufHashTree.find(HASH)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -91,7 +102,7 @@ module.exports = class CSmartContract extends require("./block-exchange")
|
|||||||
if (App) {
|
if (App) {
|
||||||
App.ResultTx = 0
|
App.ResultTx = 0
|
||||||
global.DApps.Accounts.BeginTransaction()
|
global.DApps.Accounts.BeginTransaction()
|
||||||
var StrHex = global.GetHexFromArr(global.sha3(arr[i]));
|
var StrHex = global.GetHexFromArr(HASH);
|
||||||
var item;
|
var item;
|
||||||
global.CurTrItem = undefined
|
global.CurTrItem = undefined
|
||||||
if (global.TreeFindTX) {
|
if (global.TreeFindTX) {
|
||||||
@ -148,8 +159,6 @@ module.exports = class CSmartContract extends require("./block-exchange")
|
|||||||
global.DApps[key].OnDeleteBlock(Block)
|
global.DApps[key].OnDeleteBlock(Block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnDelete(Block) {
|
|
||||||
}
|
|
||||||
IsValidTicket(Tr, BlockNum) {
|
IsValidTicket(Tr, BlockNum) {
|
||||||
this.CheckCreateTicketObject(Tr, BlockNum)
|
this.CheckCreateTicketObject(Tr, BlockNum)
|
||||||
if (Tr.power < global.MIN_POWER_POW_TR)
|
if (Tr.power < global.MIN_POWER_POW_TR)
|
||||||
@ -218,4 +227,87 @@ module.exports = class CSmartContract extends require("./block-exchange")
|
|||||||
global.TX_PROCESS.Worker.send({ cmd: "FindTX", TX: StrHex })
|
global.TX_PROCESS.Worker.send({ cmd: "FindTX", TX: StrHex })
|
||||||
return this.AddTransaction(Tr, 1);
|
return this.AddTransaction(Tr, 1);
|
||||||
}
|
}
|
||||||
|
AddTransaction(Tr, ToAll) {
|
||||||
|
// transfer-msg.ts(CMessages)
|
||||||
|
}
|
||||||
|
AddToSenderMap(Block) {
|
||||||
|
var BlockNum = Block.BlockNum;
|
||||||
|
var StrBlockHash = global.GetHexFromArr(Block.Hash);
|
||||||
|
this.SenderBlockHashMap[BlockNum] = StrBlockHash
|
||||||
|
var arr = Block.arrContent;
|
||||||
|
if (arr) {
|
||||||
|
for (var i = 0; i < arr.length; i++) {
|
||||||
|
var type = arr[i][0];
|
||||||
|
var App = global.DAppByType[type];
|
||||||
|
if (App) {
|
||||||
|
var Body = arr[i];
|
||||||
|
var SenderNum = App.GetSenderNum(BlockNum, Body);
|
||||||
|
if (SenderNum < 0)
|
||||||
|
continue;
|
||||||
|
var ItemArr = this.SenderMap[SenderNum];
|
||||||
|
if (!ItemArr) {
|
||||||
|
ItemArr = []
|
||||||
|
this.SenderMap[SenderNum] = ItemArr
|
||||||
|
}
|
||||||
|
ItemArr.push({ BlockNum: BlockNum, StrHash: StrBlockHash })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GetSenderPrioritet(BlockNum, SenderNum) {
|
||||||
|
if (!this.WasReloadSenderMapFromDB)
|
||||||
|
this.ReloadSenderMapFromDB()
|
||||||
|
if (SenderNum < 0)
|
||||||
|
return global.MAX_LENGTH_SENDER_MAP;
|
||||||
|
var MaxBlockNum = BlockNum - global.DELTA_START_SENDER_MAP;
|
||||||
|
if (MaxBlockNum > this.BlockNumDB)
|
||||||
|
return global.MAX_LENGTH_SENDER_MAP;
|
||||||
|
var ItemArr = this.SenderMap[SenderNum];
|
||||||
|
if (!ItemArr) {
|
||||||
|
return global.MAX_LENGTH_SENDER_MAP;
|
||||||
|
}
|
||||||
|
for (var i = ItemArr.length - 1; i--; i >= 0) {
|
||||||
|
var Item = ItemArr[i];
|
||||||
|
if (Item.BlockNum <= MaxBlockNum && this.SenderBlockHashMap[Item.BlockNum] === Item.StrHash) {
|
||||||
|
var Delta = MaxBlockNum - Item.BlockNum;
|
||||||
|
if (Delta > global.MAX_LENGTH_SENDER_MAP)
|
||||||
|
Delta = global.MAX_LENGTH_SENDER_MAP
|
||||||
|
return Delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return global.MAX_LENGTH_SENDER_MAP;
|
||||||
|
}
|
||||||
|
ReloadSenderMapFromDB() {
|
||||||
|
this.SenderMap = {}
|
||||||
|
this.SenderBlockHashMap = {}
|
||||||
|
var EndNum = global.GetCurrentBlockNumByTime();
|
||||||
|
var StartNum = EndNum - global.MAX_LENGTH_SENDER_MAP - global.DELTA_START_SENDER_MAP;
|
||||||
|
if (StartNum < 0)
|
||||||
|
StartNum = 0
|
||||||
|
for (var Num = StartNum; Num < EndNum; Num++) {
|
||||||
|
var Block = this.ReadBlockDB(Num);
|
||||||
|
if (!Block)
|
||||||
|
break;
|
||||||
|
this.AddToSenderMap(Block)
|
||||||
|
}
|
||||||
|
this.WasReloadSenderMapFromDB = 1
|
||||||
|
}
|
||||||
|
ClearOldSenderMapItem() {
|
||||||
|
var MinBlockNum = global.GetCurrentBlockNumByTime() - global.MAX_LENGTH_SENDER_MAP * 2;
|
||||||
|
var ArrForDel = [];
|
||||||
|
for (var key in this.SenderMap) {
|
||||||
|
var ItemArr = this.SenderMap[key];
|
||||||
|
while (ItemArr.length) {
|
||||||
|
var Item = ItemArr[0];
|
||||||
|
if (Item.BlockNum > MinBlockNum)
|
||||||
|
break;
|
||||||
|
ItemArr.shift()
|
||||||
|
}
|
||||||
|
if (ItemArr.length === 0)
|
||||||
|
ArrForDel.push(key)
|
||||||
|
}
|
||||||
|
for (var i = 0; i < ArrForDel.length; i++) {
|
||||||
|
delete this.SenderMap[ArrForDel[i]]
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -9,11 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import CSmartContract from './transaction-validator'
|
||||||
const MAX_MESSAGE_COUNT = 1000;
|
const MAX_MESSAGE_COUNT = 1000;
|
||||||
module.exports = class CMessages extends require("./transaction-validator")
|
export default class CMessages extends CSmartContract {
|
||||||
{
|
|
||||||
MemPoolMsg
|
MemPoolMsg
|
||||||
|
|
||||||
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
constructor(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual) {
|
||||||
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
super(SetKeyPair, RunIP, RunPort, UseRNDHeader, bVirtual)
|
||||||
this.MemPoolMsg = []
|
this.MemPoolMsg = []
|
||||||
@ -194,7 +193,7 @@ module.exports = class CMessages extends require("./transaction-validator")
|
|||||||
}
|
}
|
||||||
Node.TaskLastSend = CurTime
|
Node.TaskLastSend = CurTime
|
||||||
this.SendF(Node, { "Method": "TRANSACTION", "Data": Tr }, Tr.body.length + 1000)
|
this.SendF(Node, { "Method": "TRANSACTION", "Data": Tr }, Tr.body.length + 1000)
|
||||||
ToLogContext("Send " + TrName(Tr) + " to " + NodeName(Node))
|
ToLogContext("Send " + TrName(Tr) + " to " + global.NodeName(Node))
|
||||||
Count--
|
Count--
|
||||||
if (Count <= 0)
|
if (Count <= 0)
|
||||||
break;
|
break;
|
||||||
@ -206,7 +205,7 @@ module.exports = class CMessages extends require("./transaction-validator")
|
|||||||
}
|
}
|
||||||
TRANSACTION(Info, CurTime) {
|
TRANSACTION(Info, CurTime) {
|
||||||
var Tr = this.DataFromF(Info);
|
var Tr = this.DataFromF(Info);
|
||||||
ToLogContext("Receive " + TrName(Tr) + " from " + NodeName(Info.Node))
|
ToLogContext("Receive " + TrName(Tr) + " from " + global.NodeName(Info.Node))
|
||||||
this.AddTransaction(Tr, 0)
|
this.AddTransaction(Tr, 0)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Twitter: https://twitter.com/terafoundation
|
* Twitter: https://twitter.com/terafoundation
|
||||||
* Telegram: https://t.me/terafoundation
|
* Telegram: https://t.me/terafoundation
|
||||||
*/
|
*/
|
||||||
|
const fs = require('fs')
|
||||||
global.RunOnUpdate = RunOnUpdate;
|
global.RunOnUpdate = RunOnUpdate;
|
||||||
|
|
||||||
function RunOnUpdate() {
|
function RunOnUpdate() {
|
||||||
@ -146,10 +146,11 @@ function RecreateAccountHashDB3() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
import '../core/db/db-row'
|
||||||
|
|
||||||
function ReWriteDBSmartWrite() {
|
function ReWriteDBSmartWrite() {
|
||||||
global.UpdateMode = 1;
|
global.UpdateMode = 1;
|
||||||
global.ToLog("Start ReWriteDBSmartWrite");
|
global.ToLog("Start ReWriteDBSmartWrite");
|
||||||
require("../core/db/db-row");
|
|
||||||
for (var num = 0; true; num++) {
|
for (var num = 0; true; num++) {
|
||||||
var Item = global.DApps.Smart.DBSmart.Read(num);
|
var Item = global.DApps.Smart.DBSmart.Read(num);
|
||||||
if (!Item)
|
if (!Item)
|
||||||
|
36
src/global.d.ts
vendored
36
src/global.d.ts
vendored
@ -415,19 +415,19 @@ declare global {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region block-db.ts
|
// //#region block-db.ts
|
||||||
BlockDB: any;
|
// BlockDB: any;
|
||||||
BLOCK_HEADER_SIZE: number;
|
// BLOCK_HEADER_SIZE: number;
|
||||||
BLOCK_HEADER_SIZE2: number;
|
// BLOCK_HEADER_SIZE2: number;
|
||||||
DB_VERSION: number;
|
// DB_VERSION: number;
|
||||||
AddInfoChain: Function;
|
// AddInfoChain: Function;
|
||||||
AddInfoBlock: Function;
|
// AddInfoBlock: Function;
|
||||||
GetNodeStrPort: Function;
|
// GetNodeStrPort: Function;
|
||||||
NO_CHECK_BLOCKNUM_ONSTART: number;
|
// NO_CHECK_BLOCKNUM_ONSTART: number;
|
||||||
//#endregion
|
// //#endregion
|
||||||
|
|
||||||
//#region db.ts
|
//#region db.ts
|
||||||
CheckStartOneProcess: Function;
|
//CheckStartOneProcess: Function;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region update.ts
|
//#region update.ts
|
||||||
@ -439,10 +439,16 @@ declare global {
|
|||||||
FORMAT_FILE_CREATE: string;
|
FORMAT_FILE_CREATE: string;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region dapp.ts
|
// //#region dapp.ts
|
||||||
DApps: any;
|
// DApps: {
|
||||||
DAppByType: any;
|
// Accounts?: any,
|
||||||
//#endregion
|
// File?: any,
|
||||||
|
// Names?: any,
|
||||||
|
// Messager?: any,
|
||||||
|
// Smart?: any,
|
||||||
|
// };
|
||||||
|
// DAppByType: any;
|
||||||
|
// //#endregion
|
||||||
|
|
||||||
//#region names.ts
|
//#region names.ts
|
||||||
NAMES: any;
|
NAMES: any;
|
||||||
|
@ -37,12 +37,19 @@ global.glCurNumFindArr = 0;
|
|||||||
global.ArrReconnect = [];
|
global.ArrReconnect = [];
|
||||||
global.ArrConnect = [];
|
global.ArrConnect = [];
|
||||||
var FindList = [
|
var FindList = [
|
||||||
|
{ "ip": "91.235.136.81", "port": 30005 },
|
||||||
|
{ "ip": "149.154.70.158", "port": 30000 },
|
||||||
|
{ "ip": "185.240.243.182", "port": 30000 },
|
||||||
|
{ "ip": "212.109.197.205", "port": 30000 },
|
||||||
|
{ "ip": "212.109.197.209", "port": 30000 },
|
||||||
|
{ "ip": "80.87.192.24", "port": 30000 },
|
||||||
{ "ip": "60.12.241.181", "port": 30000 },
|
{ "ip": "60.12.241.181", "port": 30000 },
|
||||||
{ "ip": "60.12.241.181", "port": 30001 },
|
{ "ip": "60.12.241.181", "port": 30001 },
|
||||||
{ "ip": "60.12.241.181", "port": 30002 },
|
{ "ip": "60.12.241.181", "port": 30002 },
|
||||||
{ "ip": "60.12.241.181", "port": 30003 },
|
{ "ip": "60.12.241.181", "port": 30003 },
|
||||||
{ "ip": "60.12.241.181", "port": 30004 },
|
{ "ip": "60.12.241.181", "port": 30004 },
|
||||||
{ "ip": "60.12.241.181", "port": 30005 },];
|
{ "ip": "60.12.241.181", "port": 30005 },
|
||||||
|
];
|
||||||
if (global.LOCAL_RUN) {
|
if (global.LOCAL_RUN) {
|
||||||
FindList = [{ "ip": "127.0.0.1", "port": 50001 }, { "ip": "127.0.0.1", "port": 50002 }];
|
FindList = [{ "ip": "127.0.0.1", "port": 50001 }, { "ip": "127.0.0.1", "port": 50002 }];
|
||||||
}
|
}
|
||||||
@ -351,16 +358,12 @@ global.StopChildProcess = function() {
|
|||||||
};
|
};
|
||||||
require("../core/html-server");
|
require("../core/html-server");
|
||||||
RunServer();
|
RunServer();
|
||||||
let {
|
|
||||||
ArrReconnect,
|
|
||||||
ArrConnect
|
|
||||||
} = global
|
|
||||||
setInterval(function run1() {
|
setInterval(function run1() {
|
||||||
DoConnectToNodes(ArrReconnect, "RECONNECT");
|
DoConnectToNodes(global.ArrReconnect, "RECONNECT");
|
||||||
}, 200);
|
}, 200);
|
||||||
setInterval(function run2() {
|
setInterval(function run2() {
|
||||||
DoGetNodes();
|
DoGetNodes();
|
||||||
DoConnectToNodes(ArrConnect, "CONNECT");
|
DoConnectToNodes(global.ArrConnect, "CONNECT");
|
||||||
}, 500);
|
}, 500);
|
||||||
var StartCheckMining = 0;
|
var StartCheckMining = 0;
|
||||||
global.MiningPaused = 0;
|
global.MiningPaused = 0;
|
||||||
@ -536,7 +539,7 @@ function DoGetNodes() {
|
|||||||
return;
|
return;
|
||||||
if (global.SERVER.BusyLevel && Node.BlockProcessCount <= global.SERVER.BusyLevel)
|
if (global.SERVER.BusyLevel && Node.BlockProcessCount <= global.SERVER.BusyLevel)
|
||||||
return;
|
return;
|
||||||
if (GetSocketStatus(Node.Socket) === 100) {
|
if (global.GetSocketStatus(Node.Socket) === 100) {
|
||||||
global.SERVER.StartGetNodes(Node);
|
global.SERVER.StartGetNodes(Node);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -572,19 +575,12 @@ function DoConnectToNodes(Arr, Mode) {
|
|||||||
var idRunOnce;
|
var idRunOnce;
|
||||||
|
|
||||||
function RunServer() {
|
function RunServer() {
|
||||||
let {
|
|
||||||
GetNetworkName,
|
|
||||||
NET_WORK_MODE,
|
|
||||||
SAVE_CONST,
|
|
||||||
START_IP,
|
|
||||||
START_PORT_NUMBER
|
|
||||||
} = global
|
|
||||||
idRunOnce = setInterval(RunOnce, 1000);
|
idRunOnce = setInterval(RunOnce, 1000);
|
||||||
global.ToLog("NETWORK: " + GetNetworkName());
|
global.ToLog("NETWORK: " + global.GetNetworkName());
|
||||||
global.ToLog("VERSION: " + global.DEF_VERSION);
|
global.ToLog("VERSION: " + global.DEF_VERSION);
|
||||||
if (global.NET_WORK_MODE) {
|
if (global.NET_WORK_MODE) {
|
||||||
global.START_IP = NET_WORK_MODE.ip;
|
global.START_IP = global.NET_WORK_MODE.ip;
|
||||||
global.START_PORT_NUMBER = NET_WORK_MODE.port;
|
global.START_PORT_NUMBER = global.NET_WORK_MODE.port;
|
||||||
}
|
}
|
||||||
var KeyPair = crypto.createECDH('secp256k1');
|
var KeyPair = crypto.createECDH('secp256k1');
|
||||||
if (!global.SERVER_PRIVATE_KEY_HEX || global.NEW_SERVER_PRIVATE_KEY) {
|
if (!global.SERVER_PRIVATE_KEY_HEX || global.NEW_SERVER_PRIVATE_KEY) {
|
||||||
@ -596,7 +592,7 @@ function RunServer() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
global.SERVER_PRIVATE_KEY_HEX = global.GetHexFromArr(Arr);
|
global.SERVER_PRIVATE_KEY_HEX = global.GetHexFromArr(Arr);
|
||||||
SAVE_CONST(true);
|
global.SAVE_CONST(true);
|
||||||
}
|
}
|
||||||
var ServerPrivKey = global.GetArrFromHex(global.SERVER_PRIVATE_KEY_HEX);
|
var ServerPrivKey = global.GetArrFromHex(global.SERVER_PRIVATE_KEY_HEX);
|
||||||
if (global.USE_NET_FOR_SERVER_ADDRES) {
|
if (global.USE_NET_FOR_SERVER_ADDRES) {
|
||||||
@ -615,7 +611,7 @@ function RunServer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyPair.setPrivateKey(Buffer.from(ServerPrivKey));
|
KeyPair.setPrivateKey(Buffer.from(ServerPrivKey));
|
||||||
new CServer(KeyPair, START_IP, START_PORT_NUMBER, false, false);
|
new CServer(KeyPair, global.START_IP, global.START_PORT_NUMBER, false, false);
|
||||||
DoStartFindList();
|
DoStartFindList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -639,9 +635,9 @@ function RunOnce() {
|
|||||||
if (global.SERVER && global.SERVER.CheckOnStartComplete) {
|
if (global.SERVER && global.SERVER.CheckOnStartComplete) {
|
||||||
clearInterval(idRunOnce);
|
clearInterval(idRunOnce);
|
||||||
require("../core/update");
|
require("../core/update");
|
||||||
RunOnUpdate();
|
global.RunOnUpdate();
|
||||||
StartAllProcess(1);
|
StartAllProcess(1);
|
||||||
require("./dogs");
|
// require("./dogs");
|
||||||
if (global.RESTART_PERIOD_SEC) {
|
if (global.RESTART_PERIOD_SEC) {
|
||||||
var Period = (global.random(600) + global.RESTART_PERIOD_SEC);
|
var Period = (global.random(600) + global.RESTART_PERIOD_SEC);
|
||||||
global.ToLog("SET RESTART NODE AFTER: " + Period + " sec");
|
global.ToLog("SET RESTART NODE AFTER: " + Period + " sec");
|
||||||
|
@ -71,8 +71,8 @@ function StartHashPump(e) {
|
|||||||
(!global.BlockPump || global.BlockPump.BlockNum < e.BlockNum || global.BlockPump.MinerID !== e.MinerID || global.BlockPump.Percent !== e.Percent) && (global.BlockPump = {
|
(!global.BlockPump || global.BlockPump.BlockNum < e.BlockNum || global.BlockPump.MinerID !== e.MinerID || global.BlockPump.Percent !== e.Percent) && (global.BlockPump = {
|
||||||
BlockNum: e.BlockNum,
|
BlockNum: e.BlockNum,
|
||||||
RunCount: e.RunCount, MinerID: e.MinerID, Percent: e.Percent, LastNonce: 0
|
RunCount: e.RunCount, MinerID: e.MinerID, Percent: e.Percent, LastNonce: 0
|
||||||
}), idIntervalPump || (idIntervalPump = setInterval(PumpHash,
|
}), idIntervalPump = idIntervalPump || setInterval(PumpHash,
|
||||||
global.POWRunPeriod));
|
global.POWRunPeriod);
|
||||||
};
|
};
|
||||||
var StartTime = 1, EndTime = 0;
|
var StartTime = 1, EndTime = 0;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ process.on('error' as any, function(err: TeraError) {
|
|||||||
global.ToError("STATIC-DB:\n" + err.stack);
|
global.ToError("STATIC-DB:\n" + err.stack);
|
||||||
global.ToLog(err.stack);
|
global.ToLog(err.stack);
|
||||||
});
|
});
|
||||||
var CServerDB = require("../core/db/block-db");
|
import CServerDB from '../core/db/block-db'
|
||||||
var KeyPair = crypto.createECDH('secp256k1');
|
var KeyPair = crypto.createECDH('secp256k1');
|
||||||
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
||||||
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
||||||
|
@ -90,10 +90,9 @@ process.on('error' as any, function(err: TeraError) {
|
|||||||
global.ToLog(err.stack);
|
global.ToLog(err.stack);
|
||||||
});
|
});
|
||||||
global.HTTP_PORT_NUMBER = 0;
|
global.HTTP_PORT_NUMBER = 0;
|
||||||
var CServerDB = require("../core/transaction-validator");
|
import CServerDB from '../core/transaction-validator'
|
||||||
var KeyPair = crypto.createECDH('secp256k1');
|
var KeyPair = crypto.createECDH('secp256k1');
|
||||||
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
|
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
||||||
77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
|
||||||
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
||||||
global.TreeFindTX = new global.STreeBuffer(30 * 1000, global.CompareItemHashSimple, "string");
|
global.TreeFindTX = new global.STreeBuffer(30 * 1000, global.CompareItemHashSimple, "string");
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
@ -243,7 +242,9 @@ function InitTXProcess() {
|
|||||||
if (LastBlockNum > 100) {
|
if (LastBlockNum > 100) {
|
||||||
LastBlockNum = 1 + LastBlockNum - 100;
|
LastBlockNum = 1 + LastBlockNum - 100;
|
||||||
}
|
}
|
||||||
|
global.ToLog("Start CalcMerkleTree", 2);
|
||||||
global.DApps.Accounts.CalcMerkleTree(1);
|
global.DApps.Accounts.CalcMerkleTree(1);
|
||||||
|
global.ToLog("Finsih CalcMerkleTree", 2);
|
||||||
if (LastBlockNum <= 0)
|
if (LastBlockNum <= 0)
|
||||||
RewriteAllTransactions();
|
RewriteAllTransactions();
|
||||||
else
|
else
|
||||||
|
@ -35,12 +35,6 @@ setInterval(function() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
process.send({ cmd: "online", message: "OK" });
|
process.send({ cmd: "online", message: "OK" });
|
||||||
process.on('message', function(msg) {
|
process.on('message', function(msg) {
|
||||||
let {
|
|
||||||
GlobalRunMap,
|
|
||||||
ADD_TO_STAT,
|
|
||||||
ToLogClient0,
|
|
||||||
ArrLogClient
|
|
||||||
} = global
|
|
||||||
LastAlive = Date.now();
|
LastAlive = Date.now();
|
||||||
switch (msg.cmd) {
|
switch (msg.cmd) {
|
||||||
case "ALive":
|
case "ALive":
|
||||||
@ -62,14 +56,14 @@ process.on('message', function(msg) {
|
|||||||
process.send({ cmd: "retcall", id: msg.id, Err: Err, Params: Ret });
|
process.send({ cmd: "retcall", id: msg.id, Err: Err, Params: Ret });
|
||||||
break;
|
break;
|
||||||
case "retcall":
|
case "retcall":
|
||||||
var F = GlobalRunMap[msg.id];
|
var F = global.GlobalRunMap[msg.id];
|
||||||
if (F) {
|
if (F) {
|
||||||
delete GlobalRunMap[msg.id];
|
delete global.GlobalRunMap[msg.id];
|
||||||
F(msg.Err, msg.Params);
|
F(msg.Err, msg.Params);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "Stat":
|
case "Stat":
|
||||||
ADD_TO_STAT(msg.Name, msg.Value);
|
global.ADD_TO_STAT(msg.Name, msg.Value);
|
||||||
break;
|
break;
|
||||||
case "NodeList":
|
case "NodeList":
|
||||||
HostNodeList = msg.Value;
|
HostNodeList = msg.Value;
|
||||||
@ -85,7 +79,7 @@ process.on('message', function(msg) {
|
|||||||
}
|
}
|
||||||
case "ToLogClient":
|
case "ToLogClient":
|
||||||
{
|
{
|
||||||
ToLogClient0(msg.Str, msg.StrKey, msg.bFinal);
|
global.ToLogClient0(msg.Str, msg.StrKey, msg.bFinal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "RetFindTX":
|
case "RetFindTX":
|
||||||
@ -98,7 +92,7 @@ process.on('message', function(msg) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArrLogClient.push({ text: msg.ResultStr, key: msg.TX, final: msg.bFinal, });
|
global.ArrLogClient.push({ text: msg.ResultStr, key: msg.TX, final: msg.bFinal, });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,8 +136,7 @@ if (!global.HTTP_HOSTING_PORT) {
|
|||||||
}
|
}
|
||||||
var CServerDB = require("../core/db/block-db");
|
var CServerDB = require("../core/db/block-db");
|
||||||
var KeyPair = crypto.createECDH('secp256k1');
|
var KeyPair = crypto.createECDH('secp256k1');
|
||||||
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
|
KeyPair.setPrivateKey(Buffer.from([77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
||||||
77, 77, 77, 77, 77, 77, 77, 77, 77, 77]));
|
|
||||||
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
global.SERVER = new CServerDB(KeyPair, undefined, undefined, false, true);
|
||||||
global.HTTP_PORT_NUMBER = 0;
|
global.HTTP_PORT_NUMBER = 0;
|
||||||
require("../core/html-server");
|
require("../core/html-server");
|
||||||
@ -240,16 +233,12 @@ var bWasRun = 0;
|
|||||||
var TimeToRerun = 3000;
|
var TimeToRerun = 3000;
|
||||||
|
|
||||||
function RunListenServer() {
|
function RunListenServer() {
|
||||||
let {
|
|
||||||
ToLogClient,
|
|
||||||
LISTEN_IP
|
|
||||||
} = global
|
|
||||||
HostingServer.on('error', function(err) {
|
HostingServer.on('error', function(err) {
|
||||||
if (err.code === 'EADDRINUSE') {
|
if (err.code === 'EADDRINUSE') {
|
||||||
TimeToRerun = Math.floor(TimeToRerun * 1.1);
|
TimeToRerun = Math.floor(TimeToRerun * 1.1);
|
||||||
if (TimeToRerun > 1000000 * 1000)
|
if (TimeToRerun > 1000000 * 1000)
|
||||||
return;
|
return;
|
||||||
ToLogClient('Port ' + global.HTTP_HOSTING_PORT + ' in use, retrying...');
|
global.ToLogClient('Port ' + global.HTTP_HOSTING_PORT + ' in use, retrying...');
|
||||||
if (HostingServer.Server)
|
if (HostingServer.Server)
|
||||||
HostingServer.Server.close();
|
HostingServer.Server.close();
|
||||||
if (!bWasRun)
|
if (!bWasRun)
|
||||||
@ -261,10 +250,10 @@ function RunListenServer() {
|
|||||||
global.ToError("H##6");
|
global.ToError("H##6");
|
||||||
global.ToError(err);
|
global.ToError(err);
|
||||||
});
|
});
|
||||||
ToLogClient("Prepare to run WEB-server on port: " + global.HTTP_HOSTING_PORT);
|
global.ToLogClient("Prepare to run WEB-server on port: " + global.HTTP_HOSTING_PORT);
|
||||||
HostingServer.listen(global.HTTP_HOSTING_PORT, LISTEN_IP, function() {
|
HostingServer.listen(global.HTTP_HOSTING_PORT, global.LISTEN_IP, function() {
|
||||||
if (!bWasRun)
|
if (!bWasRun)
|
||||||
ToLogClient("Run WEB-server on " + LISTEN_IP + ":" + global.HTTP_HOSTING_PORT);
|
global.ToLogClient("Run WEB-server on " + global.LISTEN_IP + ":" + global.HTTP_HOSTING_PORT);
|
||||||
bWasRun = 1;
|
bWasRun = 1;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
const fs = require('fs');
|
if (!global.DATA_PATH || global.DATA_PATH === "")
|
||||||
const os = require('os');
|
global.DATA_PATH = "../DATA-TEST";
|
||||||
if(!global.DATA_PATH || global.DATA_PATH==="")
|
global.CODE_PATH = process.cwd();
|
||||||
global.DATA_PATH="../DATA-TEST";
|
|
||||||
global.CODE_PATH=process.cwd();
|
|
||||||
global.HTTP_PORT_NUMBER = 8080;
|
global.HTTP_PORT_NUMBER = 8080;
|
||||||
global.START_PORT_NUMBER = 40000;
|
global.START_PORT_NUMBER = 40000;
|
||||||
if(global.LOCAL_RUN===undefined)
|
if (global.LOCAL_RUN === undefined)
|
||||||
global.LOCAL_RUN=0;
|
global.LOCAL_RUN = 0;
|
||||||
|
|
||||||
global.TEST_NETWORK = 1;
|
global.TEST_NETWORK = 1;
|
||||||
|
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
const DBRow = require("../core/db/db-row");
|
import DApp from './dapp'
|
||||||
|
import DBRow from '../core/db/db-row'
|
||||||
|
import DBLib from "../core/db/db"
|
||||||
require('../core/rest_tables');
|
require('../core/rest_tables');
|
||||||
const MAX_SUM_TER = 1e9;
|
const MAX_SUM_TER = 1e9;
|
||||||
const MAX_SUM_CENT = 1e9;
|
const MAX_SUM_CENT = 1e9;
|
||||||
const DBLib = require("../core/db/db");
|
|
||||||
global.HistoryDB = new DBLib();
|
global.HistoryDB = new DBLib();
|
||||||
const FILE_NAME_HISTORY = "history-body";
|
const FILE_NAME_HISTORY = "history-body";
|
||||||
var WorkStructHistory = {};
|
var WorkStructHistory = {};
|
||||||
@ -135,8 +136,7 @@ class MerkleDBRow extends DBRow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class AccountApp extends require("./dapp")
|
class AccountApp extends DApp {
|
||||||
{
|
|
||||||
CreateTrCount
|
CreateTrCount
|
||||||
FORMAT_ACCOUNT_ROW
|
FORMAT_ACCOUNT_ROW
|
||||||
SIZE_ACCOUNT_ROW
|
SIZE_ACCOUNT_ROW
|
||||||
@ -178,8 +178,7 @@ class AccountApp extends require("./dapp")
|
|||||||
}"
|
}"
|
||||||
this.SIZE_ACCOUNT_ROW_REST = 1024
|
this.SIZE_ACCOUNT_ROW_REST = 1024
|
||||||
this.DBRest = new DBRow("accounts-rest", this.SIZE_ACCOUNT_ROW_REST, this.FORMAT_ACCOUNT_ROW_REST, bReadOnly)
|
this.DBRest = new DBRow("accounts-rest", this.SIZE_ACCOUNT_ROW_REST, this.FORMAT_ACCOUNT_ROW_REST, bReadOnly)
|
||||||
this.DBAct = new DBRow("accounts-act", 6 + 6 + (6 + 4 + 6 + 6 + 84) + 1 + 11, "{ID:uint, BlockNum:uint,PrevValue:{SumCOIN:uint,SumCENT:uint32, NextPos:uint, OperationID:uint,Smart:uint32,Data:arr80}, Mode:byte, TrNum:uint16, Reserve: arr9}",
|
this.DBAct = new DBRow("accounts-act", 6 + 6 + (6 + 4 + 6 + 6 + 84) + 1 + 11, "{ID:uint, BlockNum:uint,PrevValue:{SumCOIN:uint,SumCENT:uint32, NextPos:uint, OperationID:uint,Smart:uint32,Data:arr80}, Mode:byte, TrNum:uint16, Reserve: arr9}", bReadOnly)
|
||||||
bReadOnly)
|
|
||||||
this.DBActPrev = new DBRow("accounts-act-prev", this.DBAct.DataSize, this.DBAct.Format, bReadOnly)
|
this.DBActPrev = new DBRow("accounts-act-prev", this.DBAct.DataSize, this.DBAct.Format, bReadOnly)
|
||||||
this.FORMAT_STATE_HISTORY = "{NextPos:uint,Reserv:arr2}"
|
this.FORMAT_STATE_HISTORY = "{NextPos:uint,Reserv:arr2}"
|
||||||
this.DBStateHistory = new DBRow("history-state", 8, this.FORMAT_STATE_HISTORY, bReadOnly)
|
this.DBStateHistory = new DBRow("history-state", 8, this.FORMAT_STATE_HISTORY, bReadOnly)
|
||||||
@ -188,8 +187,7 @@ class AccountApp extends require("./dapp")
|
|||||||
this.DBStateTX = new DBRow("accounts-tx", 6 + 6 + 88, "{BlockNum:uint, BlockNumMin:uint, Reserve: arr88}", bReadOnly)
|
this.DBStateTX = new DBRow("accounts-tx", 6 + 6 + 88, "{BlockNum:uint, BlockNumMin:uint, Reserve: arr88}", bReadOnly)
|
||||||
if (global.READ_ONLY_DB)
|
if (global.READ_ONLY_DB)
|
||||||
return;
|
return;
|
||||||
this.DBAccountsHash = new DBRow("accounts-hash3", 6 + 32 + 32 + 32 + 6 + 6 + 14, "{BlockNum:uint, AccHash:hash, SumHash:hash, SmartHash:hash, AccountMax:uint, SmartCount:uint, Reserve: arr14}",
|
this.DBAccountsHash = new DBRow("accounts-hash3", 6 + 32 + 32 + 32 + 6 + 6 + 14, "{BlockNum:uint, AccHash:hash, SumHash:hash, SmartHash:hash, AccountMax:uint, SmartCount:uint, Reserve: arr14}", bReadOnly)
|
||||||
bReadOnly)
|
|
||||||
if (global.START_SERVER)
|
if (global.START_SERVER)
|
||||||
return;
|
return;
|
||||||
if (!bReadOnly)
|
if (!bReadOnly)
|
||||||
@ -210,8 +208,9 @@ class AccountApp extends require("./dapp")
|
|||||||
this.DBStateTX.Truncate(- 1)
|
this.DBStateTX.Truncate(- 1)
|
||||||
this.DBRest.Truncate(- 1)
|
this.DBRest.Truncate(- 1)
|
||||||
this._DBStateWrite({ Num: 0, PubKey: [], Value: { BlockNum: 1, SumCOIN: 0.95 * global.TOTAL_SUPPLY_TERA }, Name: "System account" }, 1)
|
this._DBStateWrite({ Num: 0, PubKey: [], Value: { BlockNum: 1, SumCOIN: 0.95 * global.TOTAL_SUPPLY_TERA }, Name: "System account" }, 1)
|
||||||
for (var i = 1; i < 8; i++)
|
for (var i = 1; i < 8; i++) {
|
||||||
this._DBStateWrite({ Num: i, PubKey: [], Value: { BlockNum: 1 }, Name: "" })
|
this._DBStateWrite({ Num: i, PubKey: [], Value: { BlockNum: 1 }, Name: "" })
|
||||||
|
}
|
||||||
this._DBStateWrite({ Num: 8, PubKey: global.GetArrFromHex(global.ARR_PUB_KEY[0]), Value: { BlockNum: 1, SumCOIN: 0.05 * global.TOTAL_SUPPLY_TERA }, Name: "Founder account" })
|
this._DBStateWrite({ Num: 8, PubKey: global.GetArrFromHex(global.ARR_PUB_KEY[0]), Value: { BlockNum: 1, SumCOIN: 0.05 * global.TOTAL_SUPPLY_TERA }, Name: "Founder account" })
|
||||||
this._DBStateWrite({ Num: 9, PubKey: global.GetArrFromHex(global.ARR_PUB_KEY[1]), Value: { BlockNum: 1, SumCOIN: 0 }, Name: "Developer account" })
|
this._DBStateWrite({ Num: 9, PubKey: global.GetArrFromHex(global.ARR_PUB_KEY[1]), Value: { BlockNum: 1, SumCOIN: 0 }, Name: "Developer account" })
|
||||||
for (var i = 10; i < global.BLOCK_PROCESSING_LENGTH2; i++)
|
for (var i = 10; i < global.BLOCK_PROCESSING_LENGTH2; i++)
|
||||||
@ -296,18 +295,19 @@ class AccountApp extends require("./dapp")
|
|||||||
var FileNameFull2 = this.DBActPrev.FileNameFull + "_del";
|
var FileNameFull2 = this.DBActPrev.FileNameFull + "_del";
|
||||||
try {
|
try {
|
||||||
fs.renameSync(this.DBActPrev.FileNameFull, FileNameFull2)
|
fs.renameSync(this.DBActPrev.FileNameFull, FileNameFull2)
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
global.ToLog("Can-t rename for delete act-file: " + FileNameFull2 + " " + e)
|
||||||
global.ToLog("Can-t rename for delete act-file: " + FileNameFull2)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fs.unlinkSync(FileNameFull2)
|
fs.unlinkSync(FileNameFull2)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fs.renameSync(this.DBAct.FileNameFull, this.DBActPrev.FileNameFull)
|
fs.renameSync(this.DBAct.FileNameFull, this.DBActPrev.FileNameFull)
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
global.ToLog("Can-t rename act-file!")
|
global.ToLog("Can-t rename act-file!")
|
||||||
|
console.error(e)
|
||||||
|
console.log(`${this.DBAct}, ${this.DBActPrev}`)
|
||||||
|
console.log(`${this.DBAct.FileNameFull}, ${this.DBActPrev.FileNameFull}`)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -358,8 +358,7 @@ class AccountApp extends require("./dapp")
|
|||||||
var Result;
|
var Result;
|
||||||
try {
|
try {
|
||||||
Result = this.OnWriteTransactionTR(Block, Body, BlockNum, TrNum, ContextFrom)
|
Result = this.OnWriteTransactionTR(Block, Body, BlockNum, TrNum, ContextFrom)
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
Result = "" + e
|
Result = "" + e
|
||||||
}
|
}
|
||||||
if (Result !== true) {
|
if (Result !== true) {
|
||||||
@ -396,8 +395,7 @@ class AccountApp extends require("./dapp")
|
|||||||
Result = 1
|
Result = 1
|
||||||
if (global.LOCAL_RUN || global.TEST_NETWORK) {
|
if (global.LOCAL_RUN || global.TEST_NETWORK) {
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (BlockNum < global.global.START_BLOCK_ACCOUNT_HASH + 200000)
|
if (BlockNum < global.global.START_BLOCK_ACCOUNT_HASH + 200000)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -531,35 +529,36 @@ class AccountApp extends require("./dapp")
|
|||||||
global.ConvertBufferToStr(TR)
|
global.ConvertBufferToStr(TR)
|
||||||
return JSON.stringify(TR, undefined, 2);
|
return JSON.stringify(TR, undefined, 2);
|
||||||
}
|
}
|
||||||
TRCheckAccountHash(Body, BlockNum, TrNum) {
|
TRCheckAccountHash(Body, BlockNum, TrNum?) {
|
||||||
if (BlockNum % global.PERIOD_ACCOUNT_HASH !== 0)
|
if (BlockNum % global.PERIOD_ACCOUNT_HASH !== 0) {
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
var TR = global.BufLib.GetObjectFromBuffer(Body, global.FORMAT_ACCOUNT_HASH3, {});
|
var TR = global.BufLib.GetObjectFromBuffer(Body, global.FORMAT_ACCOUNT_HASH3, {});
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (BlockNum < global.START_BLOCK_ACCOUNT_HASH + 200000)
|
if (BlockNum < global.START_BLOCK_ACCOUNT_HASH + 200000) {
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
var Item = this.GetAccountHashItem(TR.BlockNum);
|
var Item = this.GetAccountHashItem(TR.BlockNum);
|
||||||
if (Item && Item.BlockNum === TR.BlockNum) {
|
if (Item && Item.BlockNum === TR.BlockNum) {
|
||||||
if (global.CompareArr(Item.AccHash, TR.AccHash) === 0) {
|
if (global.CompareArr(Item.AccHash, TR.AccHash) === 0) {
|
||||||
if (TR.BlockNum >= global.START_BLOCK_ACCOUNT_HASH3) {
|
if (TR.BlockNum >= global.START_BLOCK_ACCOUNT_HASH3) {
|
||||||
if (global.CompareArr(Item.SmartHash, TR.SmartHash) === 0 && Item.AccountMax === TR.AccountMax && Item.SmartCount === TR.SmartCount) {
|
if (global.CompareArr(Item.SmartHash, TR.SmartHash) === 0 && Item.AccountMax === TR.AccountMax && Item.SmartCount === TR.SmartCount) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
TRCreateAccount(Body, BlockNum, TrNum, ContextFrom) {
|
TRCreateAccount(Body, BlockNum, TrNum, ContextFrom) {
|
||||||
if (Body.length < 90)
|
if (Body.length < 90)
|
||||||
return "Error length transaction";
|
return "Error length transaction";
|
||||||
@ -913,7 +912,7 @@ class AccountApp extends require("./dapp")
|
|||||||
GetMaxAccount() {
|
GetMaxAccount() {
|
||||||
return this.DBState.GetMaxNum();
|
return this.DBState.GetMaxNum();
|
||||||
}
|
}
|
||||||
GetRowsAccounts(start, count, Filter, bGetState) {
|
GetRowsAccounts(start, count, Filter?, bGetState?) {
|
||||||
if (Filter) {
|
if (Filter) {
|
||||||
Filter = Filter.trim()
|
Filter = Filter.trim()
|
||||||
}
|
}
|
||||||
@ -1005,7 +1004,7 @@ class AccountApp extends require("./dapp")
|
|||||||
GetActsMaxNum() {
|
GetActsMaxNum() {
|
||||||
return this.DBActPrev.GetMaxNum() + this.DBAct.GetMaxNum();
|
return this.DBActPrev.GetMaxNum() + this.DBAct.GetMaxNum();
|
||||||
}
|
}
|
||||||
GetActList(start, count) {
|
GetActList(start, count, b?) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
var num;
|
var num;
|
||||||
for (num = start; num < start + count; num++) {
|
for (num = start; num < start + count; num++) {
|
||||||
@ -1338,7 +1337,7 @@ class AccountApp extends require("./dapp")
|
|||||||
}
|
}
|
||||||
return Position;
|
return Position;
|
||||||
}
|
}
|
||||||
GetHistory(Num, Count, StartPos, MinConfirm) {
|
GetHistory(Num, Count, StartPos, MinConfirm?) {
|
||||||
if (!MinConfirm)
|
if (!MinConfirm)
|
||||||
MinConfirm = 0
|
MinConfirm = 0
|
||||||
var MaxNumBlockDB = global.SERVER.GetMaxNumBlockDB();
|
var MaxNumBlockDB = global.SERVER.GetMaxNumBlockDB();
|
||||||
@ -1392,7 +1391,6 @@ class AccountApp extends require("./dapp")
|
|||||||
return global.FLOAT_FROM_COIN(SumCoin);
|
return global.FLOAT_FROM_COIN(SumCoin);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
module.exports = AccountApp;
|
|
||||||
var App = new AccountApp;
|
var App = new AccountApp;
|
||||||
global.DApps["Accounts"] = App;
|
global.DApps["Accounts"] = App;
|
||||||
global.DAppByType[global.TYPE_TRANSACTION_CREATE] = App;
|
global.DAppByType[global.TYPE_TRANSACTION_CREATE] = App;
|
||||||
@ -1401,6 +1399,7 @@ global.DAppByType[TYPE_DEPRECATED_TRANSFER2] = App;
|
|||||||
global.DAppByType[TYPE_TRANSACTION_TRANSFER] = App;
|
global.DAppByType[TYPE_TRANSACTION_TRANSFER] = App;
|
||||||
global.DAppByType[global.TYPE_TRANSACTION_ACC_HASH] = App;
|
global.DAppByType[global.TYPE_TRANSACTION_ACC_HASH] = App;
|
||||||
|
|
||||||
|
export default AccountApp;
|
||||||
// function TestStateFiles(Size, Format) {
|
// function TestStateFiles(Size, Format) {
|
||||||
// return;
|
// return;
|
||||||
// if (global.PROCESS_NAME !== "MAIN")
|
// if (global.PROCESS_NAME !== "MAIN")
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
// import * as fs from 'fs'
|
|
||||||
class DApp {
|
class DApp {
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
@ -39,12 +38,37 @@ class DApp {
|
|||||||
}
|
}
|
||||||
OnDeleteBlock(Block) {
|
OnDeleteBlock(Block) {
|
||||||
}
|
}
|
||||||
OnWriteTransaction(Block, Body, BlockNum, TrNum) {
|
OnWriteTransaction(Block, Body, BlockNum, TrNum, next) {
|
||||||
}
|
}
|
||||||
OnMessage(Msg) {
|
OnMessage(Msg) {
|
||||||
}
|
}
|
||||||
|
Close() {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
module.exports = DApp;
|
|
||||||
|
import AccountApp from './accounts'
|
||||||
|
import SmartApp from './smart'
|
||||||
|
import MessagerApp from './messager'
|
||||||
|
import FileApp from './file'
|
||||||
|
import NameApp from './names'
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface Global {
|
||||||
|
//#region dapp.ts
|
||||||
|
DApps: {
|
||||||
|
Accounts?: AccountApp,
|
||||||
|
File?: FileApp,
|
||||||
|
Names?: NameApp,
|
||||||
|
Messager?: MessagerApp,
|
||||||
|
Smart?: SmartApp,
|
||||||
|
DBHistory?: DApp,
|
||||||
|
};
|
||||||
|
DAppByType: any;
|
||||||
|
//#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// function ReqDir(Path) {
|
// function ReqDir(Path) {
|
||||||
// if (fs.existsSync(Path)) {
|
// if (fs.existsSync(Path)) {
|
||||||
@ -59,3 +83,5 @@ module.exports = DApp;
|
|||||||
// };
|
// };
|
||||||
global.DApps = {};
|
global.DApps = {};
|
||||||
global.DAppByType = {};
|
global.DAppByType = {};
|
||||||
|
|
||||||
|
export default DApp;
|
@ -9,12 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import DApp from './dapp'
|
||||||
global.TYPE_TRANSACTION_FILE = 5;
|
global.TYPE_TRANSACTION_FILE = 5;
|
||||||
global.FORMAT_FILE_CREATE = "{type:byte,Name:str,ContentType:str,Reserve:arr10,Data:tr}";
|
global.FORMAT_FILE_CREATE = "{type:byte,Name:str,ContentType:str,Reserve:arr10,Data:tr}";
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
let WorkStructRun = {};
|
let WorkStructRun = {};
|
||||||
class FileApp extends require("./dapp")
|
class FileApp extends DApp {
|
||||||
{
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
@ -34,7 +34,8 @@ class FileApp extends require("./dapp")
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
module.exports = FileApp;
|
|
||||||
var App = new FileApp;
|
var App = new FileApp;
|
||||||
global.DApps["File"] = App;
|
global.DApps.File = App;
|
||||||
global.DAppByType[global.TYPE_TRANSACTION_FILE] = App;
|
global.DAppByType[global.TYPE_TRANSACTION_FILE] = App;
|
||||||
|
|
||||||
|
export default FileApp
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import DApp from './dapp'
|
||||||
require('../core/crypto-library');
|
require('../core/crypto-library');
|
||||||
const OPEN_TYPE_TRANSACTION = 11;
|
const OPEN_TYPE_TRANSACTION = 11;
|
||||||
const MESSAGE_TYPE_TRANSACTION = 12;
|
const MESSAGE_TYPE_TRANSACTION = 12;
|
||||||
@ -16,8 +17,10 @@ const MAX_MSG_SIZE = 1024;
|
|||||||
var TempArrayTr = new Uint8Array(MAX_MSG_SIZE);
|
var TempArrayTr = new Uint8Array(MAX_MSG_SIZE);
|
||||||
const MESSAGE_START = 9;
|
const MESSAGE_START = 9;
|
||||||
const MESSAGE_END = MAX_MSG_SIZE - 5;
|
const MESSAGE_END = MAX_MSG_SIZE - 5;
|
||||||
require("./names");
|
import './names'
|
||||||
class CApp extends require("./dapp") {
|
|
||||||
|
class MessagerApp extends DApp {
|
||||||
|
Server
|
||||||
Channels
|
Channels
|
||||||
NamesMap
|
NamesMap
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -116,8 +119,9 @@ function TestEncryptDecrypt() {
|
|||||||
console.log("Decrypt:");
|
console.log("Decrypt:");
|
||||||
console.log(Str2);
|
console.log(Str2);
|
||||||
};
|
};
|
||||||
module.exports = CApp;
|
var messager = new MessagerApp();
|
||||||
var Messager = new CApp;
|
global.DApps.Messager = messager;
|
||||||
global.DApps["Messager"] = Messager;
|
global.DAppByType[OPEN_TYPE_TRANSACTION] = messager;
|
||||||
global.DAppByType[OPEN_TYPE_TRANSACTION] = Messager;
|
global.DAppByType[MESSAGE_TYPE_TRANSACTION] = messager;
|
||||||
global.DAppByType[MESSAGE_TYPE_TRANSACTION] = Messager;
|
|
||||||
|
export default MessagerApp;
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import DApp from './dapp'
|
||||||
const NAMES_TYPE_TRANSACTION = 10;
|
const NAMES_TYPE_TRANSACTION = 10;
|
||||||
class NameApp extends require("./dapp")
|
class NameApp extends DApp {
|
||||||
{
|
Server
|
||||||
KeyValueMap;
|
KeyValueMap;
|
||||||
CurrentNameArr;
|
CurrentNameArr;
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -32,7 +33,8 @@ class NameApp extends require("./dapp")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
module.exports = NameApp;
|
var Name = new NameApp();
|
||||||
var Names = new NameApp;
|
global.DApps.Names = Name;
|
||||||
global.DApps["Names"] = Names;
|
global.DAppByType[NAMES_TYPE_TRANSACTION] = Name;
|
||||||
global.DAppByType[NAMES_TYPE_TRANSACTION] = Names;
|
|
||||||
|
export default NameApp
|
@ -9,11 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import DApp from './dapp'
|
||||||
|
import DBRow from '../core/db/db-row'
|
||||||
|
|
||||||
const LOC_ADD_NAME = "$";
|
const LOC_ADD_NAME = "$";
|
||||||
require("../HTML/JS/lexer.js");
|
require("../HTML/JS/lexer.js");
|
||||||
global.TickCounter = 0;
|
global.TickCounter = 0;
|
||||||
//@ts-ignore
|
|
||||||
const DBRow = require("../core/db/db-row");
|
|
||||||
const TYPE_TRANSACTION_SMART_CREATE = 130;
|
const TYPE_TRANSACTION_SMART_CREATE = 130;
|
||||||
global.TYPE_TRANSACTION_SMART_RUN = 135;
|
global.TYPE_TRANSACTION_SMART_RUN = 135;
|
||||||
const TYPE_TRANSACTION_SMART_CHANGE = 140;
|
const TYPE_TRANSACTION_SMART_CHANGE = 140;
|
||||||
@ -61,8 +62,7 @@ global.FORMAT_SMART_CHANGE = "{\
|
|||||||
Sign:arr64,\
|
Sign:arr64,\
|
||||||
}";
|
}";
|
||||||
const WorkStructChange = {};
|
const WorkStructChange = {};
|
||||||
class SmartApp extends require("./dapp")
|
class SmartApp extends DApp {
|
||||||
{
|
|
||||||
FORMAT_ROW
|
FORMAT_ROW
|
||||||
ROW_SIZE
|
ROW_SIZE
|
||||||
DBSmart
|
DBSmart
|
||||||
@ -364,7 +364,7 @@ class SmartApp extends require("./dapp")
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
GetRows(start, count, Filter, Category, GetAllData, bTokenGenerate) {
|
GetRows(start, count, Filter, Category, GetAllData, bTokenGenerate?) {
|
||||||
if (Filter) {
|
if (Filter) {
|
||||||
Filter = Filter.trim()
|
Filter = Filter.trim()
|
||||||
Filter = Filter.toUpperCase()
|
Filter = Filter.toUpperCase()
|
||||||
@ -1213,9 +1213,10 @@ function StaticGetSmart(Num) {
|
|||||||
};
|
};
|
||||||
ChangePrototype();
|
ChangePrototype();
|
||||||
InitEval();
|
InitEval();
|
||||||
module.exports = SmartApp;
|
|
||||||
var smartApp = new SmartApp;
|
var smartApp = new SmartApp;
|
||||||
global.DApps["Smart"] = smartApp;
|
global.DApps.Smart = smartApp;
|
||||||
global.DAppByType[TYPE_TRANSACTION_SMART_CREATE] = smartApp;
|
global.DAppByType[TYPE_TRANSACTION_SMART_CREATE] = smartApp;
|
||||||
global.DAppByType[global.TYPE_TRANSACTION_SMART_RUN] = smartApp;
|
global.DAppByType[global.TYPE_TRANSACTION_SMART_RUN] = smartApp;
|
||||||
global.DAppByType[TYPE_TRANSACTION_SMART_CHANGE] = smartApp;
|
global.DAppByType[TYPE_TRANSACTION_SMART_CHANGE] = smartApp;
|
||||||
|
|
||||||
|
export default SmartApp
|
@ -3,7 +3,6 @@
|
|||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"noUnusedLocals": true,
|
|
||||||
"target": "es5"
|
"target": "es5"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
Loading…
Reference in New Issue
Block a user