Changes updated
This commit is contained in:
parent
7a7f4c34ba
commit
f2eab024c1
@ -1167,30 +1167,18 @@ export class BlockchainBlockController {
|
|||||||
var dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
var dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||||
var tickFormat = '%H-%M';
|
var tickFormat = '%H-%M';
|
||||||
}
|
}
|
||||||
if(Difftype == "target"){
|
if(Difftype == "target"){
|
||||||
var TotalDifficultyNBlockQuery = await getConnection()
|
|
||||||
.query(
|
|
||||||
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
|
|
||||||
DATE_TRUNC('minute', timestamp at time zone '" +
|
|
||||||
process.env.TIME_ZONE +
|
|
||||||
"') as date \
|
|
||||||
from blockchain_block where " +
|
|
||||||
timeIntervalQry +
|
|
||||||
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
|
|
||||||
)
|
|
||||||
.catch(err_msg => {
|
|
||||||
next(err_msg);
|
|
||||||
});
|
|
||||||
}else if(Difftype == "solution"){
|
|
||||||
var TotalDifficultyNBlockQuery = await getConnection()
|
var TotalDifficultyNBlockQuery = await getConnection()
|
||||||
.query(
|
.query(
|
||||||
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
|
"SELECT a.hash, a.total_difficulty_randomx, a.total_difficulty_cuckatoo,a.total_difficulty_progpow, a.date FROM(select 1 as hash, (total_difficulty_cuckatoo - LAG(total_difficulty_cuckatoo) OVER (ORDER BY total_difficulty_cuckatoo)) AS total_difficulty_cuckatoo, \
|
||||||
|
(total_difficulty_progpow - LAG(total_difficulty_progpow) OVER (ORDER BY total_difficulty_progpow)) AS total_difficulty_progpow , \
|
||||||
|
(total_difficulty_randomx - LAG(total_difficulty_randomx) OVER (ORDER BY total_difficulty_randomx)) AS total_difficulty_randomx, \
|
||||||
DATE_TRUNC('minute', timestamp at time zone '" +
|
DATE_TRUNC('minute', timestamp at time zone '" +
|
||||||
process.env.TIME_ZONE +
|
process.env.TIME_ZONE +
|
||||||
"') as date \
|
"') as date \
|
||||||
from blockchain_block where " +
|
from blockchain_block where " +
|
||||||
timeIntervalQry +
|
timeIntervalQry +
|
||||||
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
|
" order by height) as a WHERE a.total_difficulty_randomx IS NOT NULL AND a.total_difficulty_progpow IS NOT NULL AND a.total_difficulty_cuckatoo IS NOT NULL AND a.total_difficulty_cuckatoo != '0' AND a.total_difficulty_randomx != '0' AND a.total_difficulty_progpow != '0'",
|
||||||
)
|
)
|
||||||
.catch(err_msg => {
|
.catch(err_msg => {
|
||||||
next(err_msg);
|
next(err_msg);
|
||||||
@ -1198,7 +1186,7 @@ export class BlockchainBlockController {
|
|||||||
}else if(Difftype == "total"){
|
}else if(Difftype == "total"){
|
||||||
var TotalDifficultyNBlockQuery = await getConnection()
|
var TotalDifficultyNBlockQuery = await getConnection()
|
||||||
.query(
|
.query(
|
||||||
"select 1 as hash, total_difficulty_"+alog_type+" as tarket_difficulty, \
|
"select 1 as hash, total_difficulty_cuckatoo,total_difficulty_progpow,total_difficulty_randomx, \
|
||||||
DATE_TRUNC('minute', timestamp at time zone '" +
|
DATE_TRUNC('minute', timestamp at time zone '" +
|
||||||
process.env.TIME_ZONE +
|
process.env.TIME_ZONE +
|
||||||
"') as date \
|
"') as date \
|
||||||
@ -1209,45 +1197,55 @@ export class BlockchainBlockController {
|
|||||||
.catch(err_msg => {
|
.catch(err_msg => {
|
||||||
next(err_msg);
|
next(err_msg);
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
var TotalDifficultyNBlockQuery = await getConnection()
|
|
||||||
.query(
|
|
||||||
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
|
|
||||||
DATE_TRUNC('minute', timestamp at time zone '" +
|
|
||||||
process.env.TIME_ZONE +
|
|
||||||
"') as date \
|
|
||||||
from blockchain_block where " +
|
|
||||||
timeIntervalQry +
|
|
||||||
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
|
|
||||||
)
|
|
||||||
.catch(err_msg => {
|
|
||||||
next(err_msg);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
let date = [],
|
let date = [],
|
||||||
//DifficultyCuckaroo = [],
|
DifficultyCuckatoo = [],
|
||||||
//DifficultyCuckatoo = [],
|
DifficultyProgpow = [],
|
||||||
//DifficultyProgpow = [],
|
DifficultyRandomx = [];
|
||||||
//DifficultyRandomx = [];
|
|
||||||
|
|
||||||
TargetDifficulty = [];
|
|
||||||
|
|
||||||
TotalDifficultyNBlockQuery.forEach(e => {
|
TotalDifficultyNBlockQuery.forEach(e => {
|
||||||
//date.indexOf(moment(e.date).format('YYYY-MM-DD')) < 0 ?
|
|
||||||
date.push(moment(e.date).format(dateFormat));
|
date.push(moment(e.date).format(dateFormat));
|
||||||
// DifficultyCuckaroo.push(parseInt(e.total_difficulty_cuckaroo));
|
DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
|
||||||
// DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
|
DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
|
||||||
// DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
|
DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
|
||||||
// DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
|
|
||||||
TargetDifficulty.push(parseInt(e.tarket_difficulty));
|
|
||||||
});
|
});
|
||||||
|
var Maxrange;
|
||||||
var Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
|
var Minrange;
|
||||||
var Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
|
if(alog_type == "cuckatoo"){
|
||||||
|
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
|
||||||
|
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
|
||||||
if(Minrange != 0){
|
if(Minrange != 0){
|
||||||
Minrange = (Minrange - (Minrange * 0.2));
|
Minrange = (Minrange - (Minrange * 0.2));
|
||||||
}
|
}
|
||||||
Maxrange = (Maxrange + (Maxrange * 0.2));
|
Maxrange = (Maxrange + (Maxrange * 0.2));
|
||||||
|
}else if(alog_type == "progpow"){
|
||||||
|
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
|
||||||
|
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
|
||||||
|
if(Minrange != 0){
|
||||||
|
Minrange = (Minrange - (Minrange * 0.2));
|
||||||
|
}
|
||||||
|
Maxrange = (Maxrange + (Maxrange * 0.2));
|
||||||
|
}else if(alog_type == "randomx"){
|
||||||
|
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
|
||||||
|
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
|
||||||
|
if(Minrange != 0){
|
||||||
|
Minrange = (Minrange - (Minrange * 0.2));
|
||||||
|
}
|
||||||
|
Maxrange = (Maxrange + (Maxrange * 0.2));
|
||||||
|
}else{
|
||||||
|
var Maxrange1 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
|
||||||
|
var Minrange1 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
|
||||||
|
var Maxrange2 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
|
||||||
|
var Minrange2 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
|
||||||
|
var Maxrange3 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
|
||||||
|
var Minrange3 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
|
||||||
|
Maxrange = Math.max(Maxrange1, Maxrange2, Maxrange3);
|
||||||
|
Minrange = Math.min(Minrange1, Minrange2, Minrange3);
|
||||||
|
if(Minrange != 0){
|
||||||
|
Minrange = (Minrange - (Minrange * 0.2));
|
||||||
|
}
|
||||||
|
Maxrange = (Maxrange + (Maxrange * 0.2));
|
||||||
|
}
|
||||||
|
|
||||||
// Minrange = parseInt(Minrange);
|
// Minrange = parseInt(Minrange);
|
||||||
// var Minrange2 = parseInt(Minrange * 0.3);
|
// var Minrange2 = parseInt(Minrange * 0.3);
|
||||||
@ -1257,12 +1255,11 @@ export class BlockchainBlockController {
|
|||||||
message: 'Difficulty and Blocks Data fetched Successfully',
|
message: 'Difficulty and Blocks Data fetched Successfully',
|
||||||
response: {
|
response: {
|
||||||
Date: date,
|
Date: date,
|
||||||
// DifficultyCuckaroo: DifficultyCuckaroo,
|
DifficultyCuckatoo: DifficultyCuckatoo,
|
||||||
// DifficultyCuckatoo: DifficultyCuckatoo,
|
DifficultyRandomx: DifficultyRandomx,
|
||||||
// DifficultyProgpow: DifficultyProgpow,
|
DifficultyProgpow: DifficultyProgpow,
|
||||||
Maxrange: Maxrange,
|
Maxrange: Maxrange,
|
||||||
Minrange: Minrange,
|
Minrange: Minrange,
|
||||||
TargetDifficulty: TargetDifficulty,
|
|
||||||
tickFormat: tickFormat
|
tickFormat: tickFormat
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -819,7 +819,7 @@ export class GraphListComponent implements OnInit {
|
|||||||
showgrid: true,
|
showgrid: true,
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
title: 'Blocks / sec',
|
title: 'Seconds / Block',
|
||||||
rangemode: 'nonnegative',
|
rangemode: 'nonnegative',
|
||||||
fixedrange: true,
|
fixedrange: true,
|
||||||
showgrid: true,
|
showgrid: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user